{"action":"created","issue":{"url":"https://api.github.com/repos/Hoverbear/raft/issues/92","labels_url":"https://api.github.com/repos/Hoverbear/raft/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/Hoverbear/raft/issues/92/comments","events_url":"https://api.github.com/repos/Hoverbear/raft/issues/92/events","html_url":"https://github.com/Hoverbear/raft/issues/92","id":101205250,"number":92,"title":"peer addresses in `Consensus`","user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-15T19:59:33Z","updated_at":"2015-08-15T22:12:10Z","closed_at":null,"body":"Did some light hacking around membership changes today and noticed that `Consensus` grabs the whole `peers` HashMap, including the peer addresses, at startup.\r\n\r\nOne issue with this is that restarting a node with a new port breaks everything: The new port is never known, so the `Consensus` can never again send leader hints which contain the right correct address.\r\n\r\nIn the same vein, the `Server` can't reconnect to such a node (only the other node can connect to it).\r\n\r\nI suggest adding the port to the server preamble and using that information to keep the `peers` map in `Server` current, and to update the `Consensus`'s accordingly on inbound requests. Future use might make it worthwhile to actually add the full peer address (since the source IP may not necessarily be the one you need to talk to for an outgoing connection). For now probably easiest to add a host:port string.\r\n\r\nIt's also worth considering removing knowledge of the `SocketAddr`s completely from `Consensus` (it's leaking the implementation of transport). The only downside that I can see is that after that change, a leader hint only contain's the leader's ID, but no way to directly connect to it. I don't think that's really necessary though, so that change might also be net positive.\r\n\r\nThe suggestions are fairly small, so if any part of them seems worthwhile, I'm happy to take a stab at it."},"comment":{"url":"https://api.github.com/repos/Hoverbear/raft/issues/comments/131456273","html_url":"https://github.com/Hoverbear/raft/issues/92#issuecomment-131456273","issue_url":"https://api.github.com/repos/Hoverbear/raft/issues/92","id":131456273,"user":{"login":"Hoverbear","id":130903,"avatar_url":"https://avatars.githubusercontent.com/u/130903?v=3","gravatar_id":"","url":"https://api.github.com/users/Hoverbear","html_url":"https://github.com/Hoverbear","followers_url":"https://api.github.com/users/Hoverbear/followers","following_url":"https://api.github.com/users/Hoverbear/following{/other_user}","gists_url":"https://api.github.com/users/Hoverbear/gists{/gist_id}","starred_url":"https://api.github.com/users/Hoverbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hoverbear/subscriptions","organizations_url":"https://api.github.com/users/Hoverbear/orgs","repos_url":"https://api.github.com/users/Hoverbear/repos","events_url":"https://api.github.com/users/Hoverbear/events{/privacy}","received_events_url":"https://api.github.com/users/Hoverbear/received_events","type":"User","site_admin":false},"created_at":"2015-08-15T22:12:10Z","updated_at":"2015-08-15T22:12:10Z","body":"These reconnection changes might be also useful for #77 (Membership changes)."}}