zettajs/zetta — pull request #34 by AdamMagaluk (2014-08-29 17:22:24+00:00)
Title: Peer reconnect issue

@mdobson @kevinswiber Let me know what you think, will work on a few tests for this later today but wanted to get your take on it sooner.

Major things:
1. root api only returns peers 'connected'.
2. all peers are marked disconnected when starting zetta, fixes peers looking like there connected after a restart.
3. http_server implements a timeout when making the initial http request to get the peers name. I set it at 5000ms for now. Tries a total of 3 times then closes socket if all fail.
4. Handshake for peer connection.
4.a Peer that is initiating a connection will only mark its peer status as 'connecting' until a http request is made back to the peer after the server is completed its connection process.
4.b http_server sends a confirmation http request once it receives the peers name and adds it to the registry.
5. Bug in peer registry that would not allow .link to work in some cases