holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.03k stars 84 forks source link

send keepalives to peers on a network change #176

Closed billiegoose closed 4 days ago

billiegoose commented 1 week ago

I can't see any difference with or without this change. Still seems like an ungodly long time (5-8 seconds) between NETWORK CHANGE and ...stream-close.

Can anyone else confirm / deny ?

Testing using my test/manual/measure-reconnect.js script and switching networks. Note: I've even tried commenting out the conn.setKeepAlive(5000) line in test/manual/measure-reconnect.js to try and give this PR every advantage.

billiegoose commented 1 week ago

@mafintosh - this works... ish. But it would probably work even better if we pessimistically began reconnecting to peers right away, then aborted the reconnecting if it turned out the connections were still alive. Got any ideas how to do that?

mafintosh commented 4 days ago

Lets land this for now, making the call non optional

billiegoose commented 4 days ago

For funsies I'm gonna test it real quick

billiegoose commented 4 days ago

Eh, my LAN connections are still so slow I can't really measure an improvement. But I have a really hard time imagining this could have a detrimental unforeseen result so I feel safe to merge it.