tomp2p / TomP2P

A P2P-based high performance key-value pair storage library
http://tomp2p.net
Apache License 2.0
438 stars 122 forks source link

Automatic reconnects? #115

Closed rkfg closed 8 years ago

rkfg commented 8 years ago

I don't see a way to automatically re-establish connection after a peer restarts or drops out of the network. Consider the following example:

A <= B <= C <= D

A doesn't bootstrap and acts as a seed node, B bootstraps to it, C bootstraps to B and D bootstraps to C. I send a message (via send(anynumber).object("string")) from another node E that bootstraps to C, all nodes receive it and show. Then I restart the peer B. Now if I once again send a message being bootstrapped to C, only D and C receive it. The network becomes split. I can bootstrap E to B and then only B and A receive it. I waited for several minutes but C never attempted to reconnect to B while it clearly knows it as it was bootstrapped to it in the first place. It could also connect to A I guess as this routing info is propagated in some way, no?

How to deal with situations like this? I expect that TomP2P, being a framework and not a library, should handle this out of the box but probably I'm missing something. I tried the code from ExampleReconnect but it doesn't seem to do the job. And it doesn't really show the reconnect as it explicitly bootstraps to the master node.

tbocek commented 8 years ago

fixed in the latest commit. The peer was assumed offline although it actively contacted other peers. Thanks for the details report