mafintosh / discovery-swarm

A network swarm that uses discovery-channel to find peers
MIT License
374 stars 57 forks source link

Fixes flaky reconnect #6 #62

Closed fnaranjo-vmw closed 4 years ago

fnaranjo-vmw commented 4 years ago

I think this patch fixes flaky reconnect #6

The problem prevented reconnecting to a peer after it was dropped for some reason. Unless the sync process was killed and restarted.

The root of the problem was that an "already seen" peer was always discarded as "duplicate" without considering that such peer may have been dropped at some point in the past.

These fix adds an extra check that only discards a peer as "duplicate" if and only if it is "already seen" AND ALSO is "currently connected".

okdistribute commented 4 years ago

This makes a lot of sense.

fnaranjo-vmw commented 4 years ago

Hi @okdistribute Will try to add some tests today :)

fnaranjo-vmw commented 4 years ago

Hello @okdistribute Added a test that should suffice to compare the behavior before and after this patch. Regards!

RangerMauve commented 4 years ago

cc @mafintosh is there anything blocking this from being merged and released?

okdistribute commented 4 years ago

published in 6.0.1