{"action":"created","comment":{"url":"https://api.github.com/repos/reverbrain/elliptics/pulls/comments/28927157","id":28927157,"diff_hunk":"@@ -612,27 +617,22 @@ void dnet_request_route_list(dnet_connect_state &state, dnet_net_state *st)\n  *\n  * If some addresses are already in the queue - they are skipped\n  */\n-static void dnet_socket_connect_new_sockets(dnet_connect_state &state, dnet_addr_socket_list *list)\n+static void dnet_socket_connect_new_sockets(const dnet_connect_state_ptr &state, dnet_addr_socket_set &list)\n {\n-\tstate.total_count += list->sockets_count;\n-\n-\tfor (size_t i = 0; i < list->sockets_count; ++i) {\n-\t\tdnet_addr_socket *socket = &list->sockets[i];\n-\t\tbool already_exist = false;\n+\tfor (auto it = list.begin(); it != list.end(); ++it) {\n+\t\tconst dnet_addr_socket_ptr &socket = *it;\n \n-\t\tdnet_addr_socket_list *other;\n-\t\tlist_for_each_entry(other, &state.sockets_list, entry) {\n-\t\t\tif (std::binary_search(other->sockets, other->sockets + other->sockets_count, *socket)) {\n-\t\t\t\talready_exist = true;\n-\t\t\t\tbreak;\n-\t\t\t}\n+\t\tif (socket->s < 0) {\n+\t\t\tstate->failed_count++;\n+\t\t\tcontinue;\n \t\t}\n \n+\t\tconst bool already_exist = state->sockets_connected.find(socket) != state->sockets_connected.end();\n \t\tif (already_exist) {\n-\t\t\tdnet_log(state.node, DNET_LOG_NOTICE, \"we are already connecting to %s\",\n+\t\t\tdnet_log(state->node, DNET_LOG_NOTICE, \"we are already connecting to %s\",","path":"library/net.cpp","position":701,"original_position":701,"commit_id":"fbd18ee095ae1d2780303dbba5262e92448394e6","original_commit_id":"fbd18ee095ae1d2780303dbba5262e92448394e6","user":{"login":"bioothod","id":1847575,"avatar_url":"https://avatars.githubusercontent.com/u/1847575?v=3","gravatar_id":"","url":"https://api.github.com/users/bioothod","html_url":"https://github.com/bioothod","followers_url":"https://api.github.com/users/bioothod/followers","following_url":"https://api.github.com/users/bioothod/following{/other_user}","gists_url":"https://api.github.com/users/bioothod/gists{/gist_id}","starred_url":"https://api.github.com/users/bioothod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bioothod/subscriptions","organizations_url":"https://api.github.com/users/bioothod/orgs","repos_url":"https://api.github.com/users/bioothod/repos","events_url":"https://api.github.com/users/bioothod/events{/privacy}","received_events_url":"https://api.github.com/users/bioothod/received_events","type":"User","site_admin":false},"body":"That should be 'we are already connected to'","created_at":"2015-04-23T00:17:17Z","updated_at":"2015-04-23T00:17:17Z","html_url":"https://github.com/reverbrain/elliptics/pull/592#discussion_r28927157","pull_request_url":"https://api.github.com/repos/reverbrain/elliptics/pulls/592","_links":{"self":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/comments/28927157"},"html":{"href":"https://github.com/reverbrain/elliptics/pull/592#discussion_r28927157"},"pull_request":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/592"}}},"pull_request":{"url":"https://api.github.com/repos/reverbrain/elliptics/pulls/592","id":33567579,"html_url":"https://github.com/reverbrain/elliptics/pull/592","diff_url":"https://github.com/reverbrain/elliptics/pull/592.diff","patch_url":"https://github.com/reverbrain/elliptics/pull/592.patch","issue_url":"https://api.github.com/repos/reverbrain/elliptics/issues/592","number":592,"state":"open","locked":false,"title":"memory leaks on reconnect failure due to timeout","user":{"login":"abudnik","id":1283969,"avatar_url":"https://avatars.githubusercontent.com/u/1283969?v=3","gravatar_id":"","url":"https://api.github.com/users/abudnik","html_url":"https://github.com/abudnik","followers_url":"https://api.github.com/users/abudnik/followers","following_url":"https://api.github.com/users/abudnik/following{/other_user}","gists_url":"https://api.github.com/users/abudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/abudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abudnik/subscriptions","organizations_url":"https://api.github.com/users/abudnik/orgs","repos_url":"https://api.github.com/users/abudnik/repos","events_url":"https://api.github.com/users/abudnik/events{/privacy}","received_events_url":"https://api.github.com/users/abudnik/received_events","type":"User","site_admin":false},"body":"socket->buffer was not released properly after failure in one of states in dnet_process_socket().\r\n\r\nRefactored dnet_addr_socket & dnet_connect_state related resource handling logic.","created_at":"2015-04-17T18:02:01Z","updated_at":"2015-04-23T00:17:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3316946a2fb9645f87072de557dcdce0f601e007","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reverbrain/elliptics/pulls/592/commits","review_comments_url":"https://api.github.com/repos/reverbrain/elliptics/pulls/592/comments","review_comment_url":"https://api.github.com/repos/reverbrain/elliptics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reverbrain/elliptics/issues/592/comments","statuses_url":"https://api.github.com/repos/reverbrain/elliptics/statuses/fbd18ee095ae1d2780303dbba5262e92448394e6","head":{"label":"abudnik:recon","ref":"recon","sha":"fbd18ee095ae1d2780303dbba5262e92448394e6","user":{"login":"abudnik","id":1283969,"avatar_url":"https://avatars.githubusercontent.com/u/1283969?v=3","gravatar_id":"","url":"https://api.github.com/users/abudnik","html_url":"https://github.com/abudnik","followers_url":"https://api.github.com/users/abudnik/followers","following_url":"https://api.github.com/users/abudnik/following{/other_user}","gists_url":"https://api.github.com/users/abudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/abudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abudnik/subscriptions","organizations_url":"https://api.github.com/users/abudnik/orgs","repos_url":"https://api.github.com/users/abudnik/repos","events_url":"https://api.github.com/users/abudnik/events{/privacy}","received_events_url":"https://api.github.com/users/abudnik/received_events","type":"User","site_admin":false},"repo":{"id":27128794,"name":"elliptics","full_name":"abudnik/elliptics","owner":{"login":"abudnik","id":1283969,"avatar_url":"https://avatars.githubusercontent.com/u/1283969?v=3","gravatar_id":"","url":"https://api.github.com/users/abudnik","html_url":"https://github.com/abudnik","followers_url":"https://api.github.com/users/abudnik/followers","following_url":"https://api.github.com/users/abudnik/following{/other_user}","gists_url":"https://api.github.com/users/abudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/abudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abudnik/subscriptions","organizations_url":"https://api.github.com/users/abudnik/orgs","repos_url":"https://api.github.com/users/abudnik/repos","events_url":"https://api.github.com/users/abudnik/events{/privacy}","received_events_url":"https://api.github.com/users/abudnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abudnik/elliptics","description":"Distributed hashtable storage","fork":true,"url":"https://api.github.com/repos/abudnik/elliptics","forks_url":"https://api.github.com/repos/abudnik/elliptics/forks","keys_url":"https://api.github.com/repos/abudnik/elliptics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abudnik/elliptics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abudnik/elliptics/teams","hooks_url":"https://api.github.com/repos/abudnik/elliptics/hooks","issue_events_url":"https://api.github.com/repos/abudnik/elliptics/issues/events{/number}","events_url":"https://api.github.com/repos/abudnik/elliptics/events","assignees_url":"https://api.github.com/repos/abudnik/elliptics/assignees{/user}","branches_url":"https://api.github.com/repos/abudnik/elliptics/branches{/branch}","tags_url":"https://api.github.com/repos/abudnik/elliptics/tags","blobs_url":"https://api.github.com/repos/abudnik/elliptics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abudnik/elliptics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abudnik/elliptics/git/refs{/sha}","trees_url":"https://api.github.com/repos/abudnik/elliptics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abudnik/elliptics/statuses/{sha}","languages_url":"https://api.github.com/repos/abudnik/elliptics/languages","stargazers_url":"https://api.github.com/repos/abudnik/elliptics/stargazers","contributors_url":"https://api.github.com/repos/abudnik/elliptics/contributors","subscribers_url":"https://api.github.com/repos/abudnik/elliptics/subscribers","subscription_url":"https://api.github.com/repos/abudnik/elliptics/subscription","commits_url":"https://api.github.com/repos/abudnik/elliptics/commits{/sha}","git_commits_url":"https://api.github.com/repos/abudnik/elliptics/git/commits{/sha}","comments_url":"https://api.github.com/repos/abudnik/elliptics/comments{/number}","issue_comment_url":"https://api.github.com/repos/abudnik/elliptics/issues/comments{/number}","contents_url":"https://api.github.com/repos/abudnik/elliptics/contents/{+path}","compare_url":"https://api.github.com/repos/abudnik/elliptics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abudnik/elliptics/merges","archive_url":"https://api.github.com/repos/abudnik/elliptics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abudnik/elliptics/downloads","issues_url":"https://api.github.com/repos/abudnik/elliptics/issues{/number}","pulls_url":"https://api.github.com/repos/abudnik/elliptics/pulls{/number}","milestones_url":"https://api.github.com/repos/abudnik/elliptics/milestones{/number}","notifications_url":"https://api.github.com/repos/abudnik/elliptics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abudnik/elliptics/labels{/name}","releases_url":"https://api.github.com/repos/abudnik/elliptics/releases{/id}","created_at":"2014-11-25T14:13:07Z","updated_at":"2015-04-21T14:54:31Z","pushed_at":"2015-04-22T15:12:37Z","git_url":"git://github.com/abudnik/elliptics.git","ssh_url":"git@github.com:abudnik/elliptics.git","clone_url":"https://github.com/abudnik/elliptics.git","svn_url":"https://github.com/abudnik/elliptics","homepage":null,"size":19845,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"reverbrain:master","ref":"master","sha":"4c53563902da19bcb58a050d6fe32ed04b573435","user":{"login":"reverbrain","id":1616511,"avatar_url":"https://avatars.githubusercontent.com/u/1616511?v=3","gravatar_id":"","url":"https://api.github.com/users/reverbrain","html_url":"https://github.com/reverbrain","followers_url":"https://api.github.com/users/reverbrain/followers","following_url":"https://api.github.com/users/reverbrain/following{/other_user}","gists_url":"https://api.github.com/users/reverbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/reverbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reverbrain/subscriptions","organizations_url":"https://api.github.com/users/reverbrain/orgs","repos_url":"https://api.github.com/users/reverbrain/repos","events_url":"https://api.github.com/users/reverbrain/events{/privacy}","received_events_url":"https://api.github.com/users/reverbrain/received_events","type":"Organization","site_admin":false},"repo":{"id":4712089,"name":"elliptics","full_name":"reverbrain/elliptics","owner":{"login":"reverbrain","id":1616511,"avatar_url":"https://avatars.githubusercontent.com/u/1616511?v=3","gravatar_id":"","url":"https://api.github.com/users/reverbrain","html_url":"https://github.com/reverbrain","followers_url":"https://api.github.com/users/reverbrain/followers","following_url":"https://api.github.com/users/reverbrain/following{/other_user}","gists_url":"https://api.github.com/users/reverbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/reverbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reverbrain/subscriptions","organizations_url":"https://api.github.com/users/reverbrain/orgs","repos_url":"https://api.github.com/users/reverbrain/repos","events_url":"https://api.github.com/users/reverbrain/events{/privacy}","received_events_url":"https://api.github.com/users/reverbrain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reverbrain/elliptics","description":"Distributed hashtable storage","fork":false,"url":"https://api.github.com/repos/reverbrain/elliptics","forks_url":"https://api.github.com/repos/reverbrain/elliptics/forks","keys_url":"https://api.github.com/repos/reverbrain/elliptics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reverbrain/elliptics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reverbrain/elliptics/teams","hooks_url":"https://api.github.com/repos/reverbrain/elliptics/hooks","issue_events_url":"https://api.github.com/repos/reverbrain/elliptics/issues/events{/number}","events_url":"https://api.github.com/repos/reverbrain/elliptics/events","assignees_url":"https://api.github.com/repos/reverbrain/elliptics/assignees{/user}","branches_url":"https://api.github.com/repos/reverbrain/elliptics/branches{/branch}","tags_url":"https://api.github.com/repos/reverbrain/elliptics/tags","blobs_url":"https://api.github.com/repos/reverbrain/elliptics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reverbrain/elliptics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reverbrain/elliptics/git/refs{/sha}","trees_url":"https://api.github.com/repos/reverbrain/elliptics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reverbrain/elliptics/statuses/{sha}","languages_url":"https://api.github.com/repos/reverbrain/elliptics/languages","stargazers_url":"https://api.github.com/repos/reverbrain/elliptics/stargazers","contributors_url":"https://api.github.com/repos/reverbrain/elliptics/contributors","subscribers_url":"https://api.github.com/repos/reverbrain/elliptics/subscribers","subscription_url":"https://api.github.com/repos/reverbrain/elliptics/subscription","commits_url":"https://api.github.com/repos/reverbrain/elliptics/commits{/sha}","git_commits_url":"https://api.github.com/repos/reverbrain/elliptics/git/commits{/sha}","comments_url":"https://api.github.com/repos/reverbrain/elliptics/comments{/number}","issue_comment_url":"https://api.github.com/repos/reverbrain/elliptics/issues/comments{/number}","contents_url":"https://api.github.com/repos/reverbrain/elliptics/contents/{+path}","compare_url":"https://api.github.com/repos/reverbrain/elliptics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reverbrain/elliptics/merges","archive_url":"https://api.github.com/repos/reverbrain/elliptics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reverbrain/elliptics/downloads","issues_url":"https://api.github.com/repos/reverbrain/elliptics/issues{/number}","pulls_url":"https://api.github.com/repos/reverbrain/elliptics/pulls{/number}","milestones_url":"https://api.github.com/repos/reverbrain/elliptics/milestones{/number}","notifications_url":"https://api.github.com/repos/reverbrain/elliptics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reverbrain/elliptics/labels{/name}","releases_url":"https://api.github.com/repos/reverbrain/elliptics/releases{/id}","created_at":"2012-06-19T10:05:10Z","updated_at":"2015-04-17T20:49:27Z","pushed_at":"2015-04-22T15:15:44Z","git_url":"git://github.com/reverbrain/elliptics.git","ssh_url":"git@github.com:reverbrain/elliptics.git","clone_url":"https://github.com/reverbrain/elliptics.git","svn_url":"https://github.com/reverbrain/elliptics","homepage":null,"size":27625,"stargazers_count":323,"watchers_count":323,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":8,"forks":54,"open_issues":8,"watchers":323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/592"},"html":{"href":"https://github.com/reverbrain/elliptics/pull/592"},"issue":{"href":"https://api.github.com/repos/reverbrain/elliptics/issues/592"},"comments":{"href":"https://api.github.com/repos/reverbrain/elliptics/issues/592/comments"},"review_comments":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/592/comments"},"review_comment":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reverbrain/elliptics/pulls/592/commits"},"statuses":{"href":"https://api.github.com/repos/reverbrain/elliptics/statuses/fbd18ee095ae1d2780303dbba5262e92448394e6"}}}}