Closed povilasb closed 6 years ago
As noted by Andrew the problem is that p2p shouldn't even do multiple STUN queries to one server at the same time. And this is actually a bug introduced by https://github.com/ustulation/p2p/commit/044351480723fba4b88805a54f75c22e5239fab7 I'm on it and will fix it soon.
Also, worth noting that if our STUN server won't close the connection after it sends response, p2p
won't be able to get the response. The issue lies here: https://github.com/ustulation/p2p/blob/master/src/mc.rs#L224 , because tokio::io::read_to_end()
will read until TCP connection is alive.
cargo run --example tcp_rendezvous_connect -- --disable-igd --traversal-server=86.100.203.141:3000 --relay=86.100.203.141:4000 "I'm 4000"
this command runs TCP example which initially does some STUN requests to determine it's public address. Unfortunately it fails with such logs:I did some research and it seems like you cannot bind and connect multiple times with the same source/destination address pair: https://idea.popcount.org/2014-04-03-bind-before-connect/
I've also got small python script to reproduce this:
it fails with such output:
So the first connect and request succeeds, but the next one fails and the error message basically says that another socket already has a connection with the same source IP:port to the same destination IP:port .