{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/comments/62414843","id":62414843,"diff_hunk":"@@ -364,98 +366,64 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {\n \treturn swarmC, nil\n }\n \n-func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs []ma.Multiaddr) (conn.Conn, error) {\n-\n-\t// sort addresses so preferred addresses are dialed sooner\n-\tsort.Sort(AddrList(remoteAddrs))\n-\n-\t// try to connect to one of the peer's known addresses.\n-\t// we dial concurrently to each of the addresses, which:\n-\t// * makes the process faster overall\n-\t// * attempts to get the fastest connection available.\n-\t// * mitigates the waste of trying bad addresses\n+func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.Multiaddr) (conn.Conn, error) {\n \tlog.Debugf(\"%s swarm dialing %s %s\", s.local, p, remoteAddrs)\n \n \tctx, cancel := context.WithCancel(ctx)\n \tdefer cancel() // cancel work when we exit func\n \n-\tconns := make(chan conn.Conn)\n-\terrs := make(chan error, len(remoteAddrs))\n+\t// use a single response type instead of errs and conns, reduces complexity *a ton*","path":"p2p/net/swarm/swarm_dial.go","position":108,"original_position":108,"commit_id":"74a15be4814aae94448a6fa39826a6261f818493","original_commit_id":"74a15be4814aae94448a6fa39826a6261f818493","user":{"login":"noffle","id":489362,"avatar_url":"https://avatars.githubusercontent.com/u/489362?v=3","gravatar_id":"","url":"https://api.github.com/users/noffle","html_url":"https://github.com/noffle","followers_url":"https://api.github.com/users/noffle/followers","following_url":"https://api.github.com/users/noffle/following{/other_user}","gists_url":"https://api.github.com/users/noffle/gists{/gist_id}","starred_url":"https://api.github.com/users/noffle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noffle/subscriptions","organizations_url":"https://api.github.com/users/noffle/orgs","repos_url":"https://api.github.com/users/noffle/repos","events_url":"https://api.github.com/users/noffle/events{/privacy}","received_events_url":"https://api.github.com/users/noffle/received_events","type":"User","site_admin":false},"body":"Haha, yes. I've learned this lesson a few times. :)","created_at":"2016-05-07T10:18:44Z","updated_at":"2016-05-07T10:18:44Z","html_url":"https://github.com/ipfs/go-libp2p/pull/38#discussion_r62414843","pull_request_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/comments/62414843"},"html":{"href":"https://github.com/ipfs/go-libp2p/pull/38#discussion_r62414843"},"pull_request":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38","id":66571708,"html_url":"https://github.com/ipfs/go-libp2p/pull/38","diff_url":"https://github.com/ipfs/go-libp2p/pull/38.diff","patch_url":"https://github.com/ipfs/go-libp2p/pull/38.patch","issue_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/38","number":38,"state":"open","locked":false,"title":"refactor swarm dialing logic","user":{"login":"whyrusleeping","id":1243164,"avatar_url":"https://avatars.githubusercontent.com/u/1243164?v=3","gravatar_id":"","url":"https://api.github.com/users/whyrusleeping","html_url":"https://github.com/whyrusleeping","followers_url":"https://api.github.com/users/whyrusleeping/followers","following_url":"https://api.github.com/users/whyrusleeping/following{/other_user}","gists_url":"https://api.github.com/users/whyrusleeping/gists{/gist_id}","starred_url":"https://api.github.com/users/whyrusleeping/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whyrusleeping/subscriptions","organizations_url":"https://api.github.com/users/whyrusleeping/orgs","repos_url":"https://api.github.com/users/whyrusleeping/repos","events_url":"https://api.github.com/users/whyrusleeping/events{/privacy}","received_events_url":"https://api.github.com/users/whyrusleeping/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-14T23:48:27Z","updated_at":"2016-05-07T10:18:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fc2289ed65e98f818d6bf55ae69622792a5091e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38/commits","review_comments_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38/comments","review_comment_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/38/comments","statuses_url":"https://api.github.com/repos/ipfs/go-libp2p/statuses/74a15be4814aae94448a6fa39826a6261f818493","head":{"label":"ipfs:sketch/dial-redo","ref":"sketch/dial-redo","sha":"74a15be4814aae94448a6fa39826a6261f818493","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":43465675,"name":"go-libp2p","full_name":"ipfs/go-libp2p","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-libp2p","description":"libp2p","fork":false,"url":"https://api.github.com/repos/ipfs/go-libp2p","forks_url":"https://api.github.com/repos/ipfs/go-libp2p/forks","keys_url":"https://api.github.com/repos/ipfs/go-libp2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-libp2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-libp2p/teams","hooks_url":"https://api.github.com/repos/ipfs/go-libp2p/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-libp2p/events","assignees_url":"https://api.github.com/repos/ipfs/go-libp2p/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-libp2p/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-libp2p/tags","blobs_url":"https://api.github.com/repos/ipfs/go-libp2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-libp2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-libp2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-libp2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-libp2p/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-libp2p/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-libp2p/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-libp2p/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-libp2p/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-libp2p/subscription","commits_url":"https://api.github.com/repos/ipfs/go-libp2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-libp2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-libp2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-libp2p/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-libp2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-libp2p/merges","archive_url":"https://api.github.com/repos/ipfs/go-libp2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-libp2p/downloads","issues_url":"https://api.github.com/repos/ipfs/go-libp2p/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-libp2p/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-libp2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-libp2p/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-libp2p/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-libp2p/deployments","created_at":"2015-09-30T23:24:32Z","updated_at":"2016-05-02T23:05:43Z","pushed_at":"2016-05-06T19:39:13Z","git_url":"git://github.com/ipfs/go-libp2p.git","ssh_url":"git@github.com:ipfs/go-libp2p.git","clone_url":"https://github.com/ipfs/go-libp2p.git","svn_url":"https://github.com/ipfs/go-libp2p","homepage":"","size":7542,"stargazers_count":155,"watchers_count":155,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":15,"forks":11,"open_issues":15,"watchers":155,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"0436764ffaed32bc67832e56782bdc1fa5cfc565","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":43465675,"name":"go-libp2p","full_name":"ipfs/go-libp2p","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-libp2p","description":"libp2p","fork":false,"url":"https://api.github.com/repos/ipfs/go-libp2p","forks_url":"https://api.github.com/repos/ipfs/go-libp2p/forks","keys_url":"https://api.github.com/repos/ipfs/go-libp2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-libp2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-libp2p/teams","hooks_url":"https://api.github.com/repos/ipfs/go-libp2p/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-libp2p/events","assignees_url":"https://api.github.com/repos/ipfs/go-libp2p/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-libp2p/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-libp2p/tags","blobs_url":"https://api.github.com/repos/ipfs/go-libp2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-libp2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-libp2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-libp2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-libp2p/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-libp2p/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-libp2p/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-libp2p/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-libp2p/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-libp2p/subscription","commits_url":"https://api.github.com/repos/ipfs/go-libp2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-libp2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-libp2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-libp2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-libp2p/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-libp2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-libp2p/merges","archive_url":"https://api.github.com/repos/ipfs/go-libp2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-libp2p/downloads","issues_url":"https://api.github.com/repos/ipfs/go-libp2p/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-libp2p/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-libp2p/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-libp2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-libp2p/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-libp2p/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-libp2p/deployments","created_at":"2015-09-30T23:24:32Z","updated_at":"2016-05-02T23:05:43Z","pushed_at":"2016-05-06T19:39:13Z","git_url":"git://github.com/ipfs/go-libp2p.git","ssh_url":"git@github.com:ipfs/go-libp2p.git","clone_url":"https://github.com/ipfs/go-libp2p.git","svn_url":"https://github.com/ipfs/go-libp2p","homepage":"","size":7542,"stargazers_count":155,"watchers_count":155,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":15,"forks":11,"open_issues":15,"watchers":155,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38"},"html":{"href":"https://github.com/ipfs/go-libp2p/pull/38"},"issue":{"href":"https://api.github.com/repos/ipfs/go-libp2p/issues/38"},"comments":{"href":"https://api.github.com/repos/ipfs/go-libp2p/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/go-libp2p/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/go-libp2p/statuses/74a15be4814aae94448a6fa39826a6261f818493"}}}}