linux build 'cannot assign requested address'
Closed this issue · 3 comments
Linux build fails to hole punch locally with:
This is after making regular linux sockets use SO_REUSEADDR and SO_REUSEPORT which is what fixed a previous similar issue with the linux build.
However last time there was no EADDRNOTAVAIL error.
Have just suspected it may be an issue with how retrying a hole punch works.
Twas not the issue I had suspected.
I originally thought it was a problem with creating the replacement socket before destroying the one that failed, but after explicitly destroying the one the failed before creating the replacement it died.
Originally:
peer_kit.public_connector = std::make_unique<NonBlockingConnector>(stuff);
Attempted fix:
peer_kit.public_connector = nullptr;
peer_kit.public_connector = std::make_unique<NonBlockingConnector>(stuff);
It seems re-arranging the order of calls connect_peer has fixed the linux build
Namely changing:
auto status = connect_public(peer_kit);
if(status != EXECUTION_STATUS::PEER_CONNECTED)
status = connect_private(init_kit, peer_kit);
if(status != EXECUTION_STATUS::PEER_CONNECTED)
status = connect_listener(init_kit, peer_kit);
return status;
to
auto status = connect_listener(peer_kit);
if(status != EXECUTION_STATUS::PEER_CONNECTED)
status = connect_public(init_kit, peer_kit);
if(status != EXECUTION_STATUS::PEER_CONNECTED)
status = connect_private(init_kit, peer_kit);
return status;
Fixed it.
About to test if I can introduce a delay to one of the peers, and see if it still works then.
As expected adding a delay to one of the peers causes things to fail.
However this might be outside the scope of this issue.
As such I will close this issue and make a bigger one addressing this.