{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/comments/80754511","pull_request_review_id":1788020,"id":80754511,"diff_hunk":"@@ -1178,21 +1239,64 @@ func (n *Node) sendToMember(members map[uint64]*membership.Member, m raftpb.Mess\n \t\t}\n \t\tn.ReportUnreachable(m.To)\n \n+\t\tlastSeenHost := n.cluster.LastSeenHost(m.To)\n+\t\tif lastSeenHost != \"\" {\n+\t\t\t// Check if address has changed\n+\t\t\tofficialHost, officialPort, _ := net.SplitHostPort(conn.Addr)\n+\t\t\tif officialHost != lastSeenHost {\n+\t\t\t\treconnectAddr := net.JoinHostPort(lastSeenHost, officialPort)\n+\t\t\t\tn.handleAddressChange(conn, reconnectAddr)\n+\t\t\t\treturn\n+\t\t\t}\n+\t\t}\n+\n \t\t// Bounce the connection\n \t\tnewConn, err := n.ConnectToMember(conn.Addr, 0)\n \t\tif err != nil {\n \t\t\tn.Config.Logger.Errorf(\"could connect to member ID %x at %s: %v\", m.To, conn.Addr, err)\n-\t\t} else {\n-\t\t\terr = n.cluster.ReplaceMemberConnection(m.To, conn, newConn)\n-\t\t\tif err != nil {\n-\t\t\t\tnewConn.Conn.Close()\n-\t\t\t}\n+\t\t\treturn\n+\t\t}\n+\t\tif n.cluster.ReplaceMemberConnection(m.To, conn, newConn, conn.Addr, false) != nil {","path":"manager/state/raft/raft.go","position":117,"original_position":117,"commit_id":"fe17c77453cded38fcaaae3603e9545280fd8c97","original_commit_id":"fe17c77453cded38fcaaae3603e9545280fd8c97","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"The error's basically impossible. It can only happen if the node is removed while running this function.\r\n\r\nAny suggestions on better syntax?","created_at":"2016-09-27T17:54:08Z","updated_at":"2016-09-27T17:54:08Z","html_url":"https://github.com/docker/swarmkit/pull/1579#discussion_r80754511","pull_request_url":"https://api.github.com/repos/docker/swarmkit/pulls/1579","_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments/80754511"},"html":{"href":"https://github.com/docker/swarmkit/pull/1579#discussion_r80754511"},"pull_request":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1579"}}},"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/1579","id":86974562,"html_url":"https://github.com/docker/swarmkit/pull/1579","diff_url":"https://github.com/docker/swarmkit/pull/1579.diff","patch_url":"https://github.com/docker/swarmkit/pull/1579.patch","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/1579","number":1579,"state":"open","locked":false,"title":"[WIP] Support manager address changes","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"body":"One of the things necessary to unblock full support for swarm mode in Docker for Mac/Windows is support for dynamic IP addresses on managers. Users of Docker for Mac/Windows are much more likely to be running in an environment like a laptop with WiFi. Of course, this will also be useful in other setups.\r\n\r\nThis PR begins to explore allowing address changes at the raft level. Each manager keeps track of the last source address it saw in RPCs from each other manager. When a send fails, and the most recently seen source address differs from the address we're sending to, and the observed address passes a health check, we switch to that address. Also, if this happens on the leader, the new address will be written to raft. Nodes are protected from election loops during an address change by ignoring vote requests unless the sender passes a health check.\r\n\r\nOne nice property of this approach is that address changes are recognized automatically, and don't need the admin or the manager whose address changed to specifically request an address change.\r\n\r\nI haven't tested this yet, so the next step will be to write a unit test that confirms it works.\r\n\r\nThere will probably need to be libnetwork changes to fully support dynamic addresses.\r\n\r\nAlso, this does not address the case where quorum is lost (i.e. all nodes restarting and changing their addresses at the same time). We will probably need some kind of variant of `--force-new-cluster` to deal with that.\r\n\r\ncc @justincormack @LK4D4","created_at":"2016-09-27T17:25:18Z","updated_at":"2016-09-27T17:54:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"070ef34d63eb848ffb0fd78d01f7c72b2ade64ec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarmkit/pulls/1579/commits","review_comments_url":"https://api.github.com/repos/docker/swarmkit/pulls/1579/comments","review_comment_url":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/1579/comments","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/fe17c77453cded38fcaaae3603e9545280fd8c97","head":{"label":"aaronlehmann:dynamic-addressing","ref":"dynamic-addressing","sha":"fe17c77453cded38fcaaae3603e9545280fd8c97","user":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"repo":{"id":61081831,"name":"swarmkit","full_name":"aaronlehmann/swarmkit","owner":{"login":"aaronlehmann","id":10601430,"avatar_url":"https://avatars.githubusercontent.com/u/10601430?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronlehmann","html_url":"https://github.com/aaronlehmann","followers_url":"https://api.github.com/users/aaronlehmann/followers","following_url":"https://api.github.com/users/aaronlehmann/following{/other_user}","gists_url":"https://api.github.com/users/aaronlehmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronlehmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronlehmann/subscriptions","organizations_url":"https://api.github.com/users/aaronlehmann/orgs","repos_url":"https://api.github.com/users/aaronlehmann/repos","events_url":"https://api.github.com/users/aaronlehmann/events{/privacy}","received_events_url":"https://api.github.com/users/aaronlehmann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aaronlehmann/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":true,"url":"https://api.github.com/repos/aaronlehmann/swarmkit","forks_url":"https://api.github.com/repos/aaronlehmann/swarmkit/forks","keys_url":"https://api.github.com/repos/aaronlehmann/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aaronlehmann/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aaronlehmann/swarmkit/teams","hooks_url":"https://api.github.com/repos/aaronlehmann/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/aaronlehmann/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/aaronlehmann/swarmkit/events","assignees_url":"https://api.github.com/repos/aaronlehmann/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/aaronlehmann/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/aaronlehmann/swarmkit/tags","blobs_url":"https://api.github.com/repos/aaronlehmann/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aaronlehmann/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aaronlehmann/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/aaronlehmann/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aaronlehmann/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/aaronlehmann/swarmkit/languages","stargazers_url":"https://api.github.com/repos/aaronlehmann/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/aaronlehmann/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/aaronlehmann/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/aaronlehmann/swarmkit/subscription","commits_url":"https://api.github.com/repos/aaronlehmann/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/aaronlehmann/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/aaronlehmann/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/aaronlehmann/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/aaronlehmann/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/aaronlehmann/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aaronlehmann/swarmkit/merges","archive_url":"https://api.github.com/repos/aaronlehmann/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aaronlehmann/swarmkit/downloads","issues_url":"https://api.github.com/repos/aaronlehmann/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/aaronlehmann/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/aaronlehmann/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/aaronlehmann/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aaronlehmann/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/aaronlehmann/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/aaronlehmann/swarmkit/deployments","created_at":"2016-06-14T01:29:55Z","updated_at":"2016-06-14T01:29:56Z","pushed_at":"2016-09-27T17:49:33Z","git_url":"git://github.com/aaronlehmann/swarmkit.git","ssh_url":"git@github.com:aaronlehmann/swarmkit.git","clone_url":"https://github.com/aaronlehmann/swarmkit.git","svn_url":"https://github.com/aaronlehmann/swarmkit","homepage":"","size":10475,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"a1262866f0bf6b5c82512fb7b725070366295f60","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":51556828,"name":"swarmkit","full_name":"docker/swarmkit","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":false,"url":"https://api.github.com/repos/docker/swarmkit","forks_url":"https://api.github.com/repos/docker/swarmkit/forks","keys_url":"https://api.github.com/repos/docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarmkit/events","assignees_url":"https://api.github.com/repos/docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarmkit/merges","archive_url":"https://api.github.com/repos/docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/swarmkit/deployments","created_at":"2016-02-12T00:02:15Z","updated_at":"2016-09-24T04:56:23Z","pushed_at":"2016-09-27T17:50:11Z","git_url":"git://github.com/docker/swarmkit.git","ssh_url":"git@github.com:docker/swarmkit.git","clone_url":"https://github.com/docker/swarmkit.git","svn_url":"https://github.com/docker/swarmkit","homepage":"","size":21631,"stargazers_count":949,"watchers_count":949,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":184,"mirror_url":null,"open_issues_count":177,"forks":184,"open_issues":177,"watchers":949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1579"},"html":{"href":"https://github.com/docker/swarmkit/pull/1579"},"issue":{"href":"https://api.github.com/repos/docker/swarmkit/issues/1579"},"comments":{"href":"https://api.github.com/repos/docker/swarmkit/issues/1579/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1579/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/1579/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarmkit/statuses/fe17c77453cded38fcaaae3603e9545280fd8c97"}}}}
{"actor":{"display_login":"aaronlehmann"}}