n0-computer / iroh

A toolkit for building distributed applications
https://iroh.computer
Apache License 2.0
2.54k stars 158 forks source link

Plugging and unplugging the network cable can increase the success rate of hole punching. #2856

Open zh522130 opened 3 days ago

zh522130 commented 3 days ago

Testing environment:

iroh-net version: v0.27.0 server (Linux, Windows), client (Windows).

client is a laptop that supports both Wi-Fi and Ethernet connections.

Result

  1. When the client program starts, it's only connected to Wi-Fi. At this point, it can only use relay. I plug in the Ethernet cable, and after a while, it switches to direct connection. I then unplug the cable, and after a while, it switches back to relay.

    The network change is Wi-Fi → Wi-Fi + Ethernet → Wi-Fi, The connection state changes from relay → direct → relay.

  2. When the client program starts, it's connected to both Wi-Fi and Ethernet. At this point, it can only use relay. I unplug the cable, and after a while, it switches to direct connection. I then plug in the cable again, and after a while, it switches back to relay.

    The network change is Wi-Fi + Ethernet → Wi-Fi → Wi-Fi + Ethernet, The connection state changes from relay → direct → relay.

For detailed steps, please refer to the attached log.

wif---wifi+eth---wifi.log wifi+eth---wifi---wifi+eth.log

matheus23 commented 3 days ago

Anything to do with multiple network interfaces may be related to #2632