{"action":"created","comment":{"url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/comments/200935746","pull_request_review_id":135338326,"id":200935746,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDkzNTc0Ng==","diff_hunk":"@@ -68,7 +67,33 @@ static void close_socket(int* cli_sock)\n     }\n }\n \n-P2PComm::P2PComm() {}\n+P2PComm::P2PComm()\n+{\n+    auto func = [this]() -> void {\n+        while (true)\n+        {\n+            this_thread::sleep_for(chrono::seconds(BROADCAST_INTERVAL));\n+            lock_guard<mutex> guard(m_broadcastToRemovedMutex);\n+\n+            for (unsigned int i = 0; i < BROADCAST_INTERVAL; ++i)\n+            {\n+                auto it = m_broadcastToRemoved.find(time(nullptr)\n+                                                    - BROADCAST_EXPIRY - i);\n+\n+                if (m_broadcastToRemoved.end() == it)\n+                    continue;","path":"src/libNetwork/P2PComm.cpp","position":27,"original_position":27,"commit_id":"819e5db24c721b262c5e376de714b53c4c4abc12","original_commit_id":"819e5db24c721b262c5e376de714b53c4c4abc12","user":{"login":"bb111189","id":4401980,"node_id":"MDQ6VXNlcjQ0MDE5ODA=","avatar_url":"https://avatars3.githubusercontent.com/u/4401980?v=4","gravatar_id":"","url":"https://api.github.com/users/bb111189","html_url":"https://github.com/bb111189","followers_url":"https://api.github.com/users/bb111189/followers","following_url":"https://api.github.com/users/bb111189/following{/other_user}","gists_url":"https://api.github.com/users/bb111189/gists{/gist_id}","starred_url":"https://api.github.com/users/bb111189/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bb111189/subscriptions","organizations_url":"https://api.github.com/users/bb111189/orgs","repos_url":"https://api.github.com/users/bb111189/repos","events_url":"https://api.github.com/users/bb111189/events{/privacy}","received_events_url":"https://api.github.com/users/bb111189/received_events","type":"User","site_admin":false},"body":"Enclosed with {}","created_at":"2018-07-09T09:22:30Z","updated_at":"2018-07-09T09:22:36Z","html_url":"https://github.com/Zilliqa/Zilliqa/pull/411#discussion_r200935746","pull_request_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/comments/200935746"},"html":{"href":"https://github.com/Zilliqa/Zilliqa/pull/411#discussion_r200935746"},"pull_request":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411"}}},"pull_request":{"url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411","id":200027356,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwMDI3MzU2","html_url":"https://github.com/Zilliqa/Zilliqa/pull/411","diff_url":"https://github.com/Zilliqa/Zilliqa/pull/411.diff","patch_url":"https://github.com/Zilliqa/Zilliqa/pull/411.patch","issue_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/411","number":411,"state":"open","locked":false,"title":"Use only 1 thread to handle to-be-removed broadcast messages","user":{"login":"ckyang","id":13886288,"node_id":"MDQ6VXNlcjEzODg2Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/13886288?v=4","gravatar_id":"","url":"https://api.github.com/users/ckyang","html_url":"https://github.com/ckyang","followers_url":"https://api.github.com/users/ckyang/followers","following_url":"https://api.github.com/users/ckyang/following{/other_user}","gists_url":"https://api.github.com/users/ckyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ckyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckyang/subscriptions","organizations_url":"https://api.github.com/users/ckyang/orgs","repos_url":"https://api.github.com/users/ckyang/repos","events_url":"https://api.github.com/users/ckyang/events{/privacy}","received_events_url":"https://api.github.com/users/ckyang/received_events","type":"User","site_admin":false},"body":"## Description\r\nFor broadcast messages which will be removed soon, currently we create threads for each message.\r\nThis would result in the overwhelmed thread usage.\r\nIn this PR, we use only 1 thread to handle this.\r\n<!-- What is the overall goals of your pull request? -->\r\n<!-- What is the context of your pull request? -->\r\n<!-- What are the related issues and pull requests? -->\r\n\r\n## Review Suggestion\r\n<!-- How should the reviewers get started on reviewing your pull request-->\r\n<!-- How can the reviewers verify the pull request is working as expected -->\r\n\r\n## Status\r\n\r\n### Implementation\r\n<!-- Add more TODOs before \"ready for review\", if any  -->\r\n- [x] **ready for review**\r\n\r\n### Integration Test (Core Team)\r\n<!-- This is for core team only, ignore this if you are a community contributor -->\r\n- [x] local machine test\r\n- [ ] small-scale cloud test\r\n","created_at":"2018-07-09T08:35:23Z","updated_at":"2018-07-09T09:22:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6dd02220697f1a2c280008083283cb085fc0469","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411/commits","review_comments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411/comments","review_comment_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/411/comments","statuses_url":"https://api.github.com/repos/Zilliqa/Zilliqa/statuses/819e5db24c721b262c5e376de714b53c4c4abc12","head":{"label":"Zilliqa:p2pthread","ref":"p2pthread","sha":"819e5db24c721b262c5e376de714b53c4c4abc12","user":{"login":"Zilliqa","id":32560879,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNTYwODc5","avatar_url":"https://avatars1.githubusercontent.com/u/32560879?v=4","gravatar_id":"","url":"https://api.github.com/users/Zilliqa","html_url":"https://github.com/Zilliqa","followers_url":"https://api.github.com/users/Zilliqa/followers","following_url":"https://api.github.com/users/Zilliqa/following{/other_user}","gists_url":"https://api.github.com/users/Zilliqa/gists{/gist_id}","starred_url":"https://api.github.com/users/Zilliqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zilliqa/subscriptions","organizations_url":"https://api.github.com/users/Zilliqa/orgs","repos_url":"https://api.github.com/users/Zilliqa/repos","events_url":"https://api.github.com/users/Zilliqa/events{/privacy}","received_events_url":"https://api.github.com/users/Zilliqa/received_events","type":"Organization","site_admin":false},"repo":{"id":115495630,"node_id":"MDEwOlJlcG9zaXRvcnkxMTU0OTU2MzA=","name":"Zilliqa","full_name":"Zilliqa/Zilliqa","owner":{"login":"Zilliqa","id":32560879,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNTYwODc5","avatar_url":"https://avatars1.githubusercontent.com/u/32560879?v=4","gravatar_id":"","url":"https://api.github.com/users/Zilliqa","html_url":"https://github.com/Zilliqa","followers_url":"https://api.github.com/users/Zilliqa/followers","following_url":"https://api.github.com/users/Zilliqa/following{/other_user}","gists_url":"https://api.github.com/users/Zilliqa/gists{/gist_id}","starred_url":"https://api.github.com/users/Zilliqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zilliqa/subscriptions","organizations_url":"https://api.github.com/users/Zilliqa/orgs","repos_url":"https://api.github.com/users/Zilliqa/repos","events_url":"https://api.github.com/users/Zilliqa/events{/privacy}","received_events_url":"https://api.github.com/users/Zilliqa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Zilliqa/Zilliqa","description":"Zilliqa is the world's first high-throughput public blockchain platform - designed to scale to thousands ​of transactions per second.","fork":false,"url":"https://api.github.com/repos/Zilliqa/Zilliqa","forks_url":"https://api.github.com/repos/Zilliqa/Zilliqa/forks","keys_url":"https://api.github.com/repos/Zilliqa/Zilliqa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zilliqa/Zilliqa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zilliqa/Zilliqa/teams","hooks_url":"https://api.github.com/repos/Zilliqa/Zilliqa/hooks","issue_events_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/events{/number}","events_url":"https://api.github.com/repos/Zilliqa/Zilliqa/events","assignees_url":"https://api.github.com/repos/Zilliqa/Zilliqa/assignees{/user}","branches_url":"https://api.github.com/repos/Zilliqa/Zilliqa/branches{/branch}","tags_url":"https://api.github.com/repos/Zilliqa/Zilliqa/tags","blobs_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zilliqa/Zilliqa/statuses/{sha}","languages_url":"https://api.github.com/repos/Zilliqa/Zilliqa/languages","stargazers_url":"https://api.github.com/repos/Zilliqa/Zilliqa/stargazers","contributors_url":"https://api.github.com/repos/Zilliqa/Zilliqa/contributors","subscribers_url":"https://api.github.com/repos/Zilliqa/Zilliqa/subscribers","subscription_url":"https://api.github.com/repos/Zilliqa/Zilliqa/subscription","commits_url":"https://api.github.com/repos/Zilliqa/Zilliqa/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zilliqa/Zilliqa/contents/{+path}","compare_url":"https://api.github.com/repos/Zilliqa/Zilliqa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zilliqa/Zilliqa/merges","archive_url":"https://api.github.com/repos/Zilliqa/Zilliqa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zilliqa/Zilliqa/downloads","issues_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues{/number}","pulls_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls{/number}","milestones_url":"https://api.github.com/repos/Zilliqa/Zilliqa/milestones{/number}","notifications_url":"https://api.github.com/repos/Zilliqa/Zilliqa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zilliqa/Zilliqa/labels{/name}","releases_url":"https://api.github.com/repos/Zilliqa/Zilliqa/releases{/id}","deployments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/deployments","created_at":"2017-12-27T07:42:33Z","updated_at":"2018-07-09T08:35:21Z","pushed_at":"2018-07-09T09:16:37Z","git_url":"git://github.com/Zilliqa/Zilliqa.git","ssh_url":"git@github.com:Zilliqa/Zilliqa.git","clone_url":"https://github.com/Zilliqa/Zilliqa.git","svn_url":"https://github.com/Zilliqa/Zilliqa","homepage":"https://www.zilliqa.com","size":14718,"stargazers_count":563,"watchers_count":563,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":112,"mirror_url":null,"archived":false,"open_issues_count":67,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":112,"open_issues":67,"watchers":563,"default_branch":"master"}},"base":{"label":"Zilliqa:master","ref":"master","sha":"808a784c39484fc8c47a74f3a343999ce75a2468","user":{"login":"Zilliqa","id":32560879,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNTYwODc5","avatar_url":"https://avatars1.githubusercontent.com/u/32560879?v=4","gravatar_id":"","url":"https://api.github.com/users/Zilliqa","html_url":"https://github.com/Zilliqa","followers_url":"https://api.github.com/users/Zilliqa/followers","following_url":"https://api.github.com/users/Zilliqa/following{/other_user}","gists_url":"https://api.github.com/users/Zilliqa/gists{/gist_id}","starred_url":"https://api.github.com/users/Zilliqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zilliqa/subscriptions","organizations_url":"https://api.github.com/users/Zilliqa/orgs","repos_url":"https://api.github.com/users/Zilliqa/repos","events_url":"https://api.github.com/users/Zilliqa/events{/privacy}","received_events_url":"https://api.github.com/users/Zilliqa/received_events","type":"Organization","site_admin":false},"repo":{"id":115495630,"node_id":"MDEwOlJlcG9zaXRvcnkxMTU0OTU2MzA=","name":"Zilliqa","full_name":"Zilliqa/Zilliqa","owner":{"login":"Zilliqa","id":32560879,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNTYwODc5","avatar_url":"https://avatars1.githubusercontent.com/u/32560879?v=4","gravatar_id":"","url":"https://api.github.com/users/Zilliqa","html_url":"https://github.com/Zilliqa","followers_url":"https://api.github.com/users/Zilliqa/followers","following_url":"https://api.github.com/users/Zilliqa/following{/other_user}","gists_url":"https://api.github.com/users/Zilliqa/gists{/gist_id}","starred_url":"https://api.github.com/users/Zilliqa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zilliqa/subscriptions","organizations_url":"https://api.github.com/users/Zilliqa/orgs","repos_url":"https://api.github.com/users/Zilliqa/repos","events_url":"https://api.github.com/users/Zilliqa/events{/privacy}","received_events_url":"https://api.github.com/users/Zilliqa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Zilliqa/Zilliqa","description":"Zilliqa is the world's first high-throughput public blockchain platform - designed to scale to thousands ​of transactions per second.","fork":false,"url":"https://api.github.com/repos/Zilliqa/Zilliqa","forks_url":"https://api.github.com/repos/Zilliqa/Zilliqa/forks","keys_url":"https://api.github.com/repos/Zilliqa/Zilliqa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zilliqa/Zilliqa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zilliqa/Zilliqa/teams","hooks_url":"https://api.github.com/repos/Zilliqa/Zilliqa/hooks","issue_events_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/events{/number}","events_url":"https://api.github.com/repos/Zilliqa/Zilliqa/events","assignees_url":"https://api.github.com/repos/Zilliqa/Zilliqa/assignees{/user}","branches_url":"https://api.github.com/repos/Zilliqa/Zilliqa/branches{/branch}","tags_url":"https://api.github.com/repos/Zilliqa/Zilliqa/tags","blobs_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zilliqa/Zilliqa/statuses/{sha}","languages_url":"https://api.github.com/repos/Zilliqa/Zilliqa/languages","stargazers_url":"https://api.github.com/repos/Zilliqa/Zilliqa/stargazers","contributors_url":"https://api.github.com/repos/Zilliqa/Zilliqa/contributors","subscribers_url":"https://api.github.com/repos/Zilliqa/Zilliqa/subscribers","subscription_url":"https://api.github.com/repos/Zilliqa/Zilliqa/subscription","commits_url":"https://api.github.com/repos/Zilliqa/Zilliqa/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zilliqa/Zilliqa/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zilliqa/Zilliqa/contents/{+path}","compare_url":"https://api.github.com/repos/Zilliqa/Zilliqa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zilliqa/Zilliqa/merges","archive_url":"https://api.github.com/repos/Zilliqa/Zilliqa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zilliqa/Zilliqa/downloads","issues_url":"https://api.github.com/repos/Zilliqa/Zilliqa/issues{/number}","pulls_url":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls{/number}","milestones_url":"https://api.github.com/repos/Zilliqa/Zilliqa/milestones{/number}","notifications_url":"https://api.github.com/repos/Zilliqa/Zilliqa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zilliqa/Zilliqa/labels{/name}","releases_url":"https://api.github.com/repos/Zilliqa/Zilliqa/releases{/id}","deployments_url":"https://api.github.com/repos/Zilliqa/Zilliqa/deployments","created_at":"2017-12-27T07:42:33Z","updated_at":"2018-07-09T08:35:21Z","pushed_at":"2018-07-09T09:16:37Z","git_url":"git://github.com/Zilliqa/Zilliqa.git","ssh_url":"git@github.com:Zilliqa/Zilliqa.git","clone_url":"https://github.com/Zilliqa/Zilliqa.git","svn_url":"https://github.com/Zilliqa/Zilliqa","homepage":"https://www.zilliqa.com","size":14718,"stargazers_count":563,"watchers_count":563,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":112,"mirror_url":null,"archived":false,"open_issues_count":67,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":112,"open_issues":67,"watchers":563,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411"},"html":{"href":"https://github.com/Zilliqa/Zilliqa/pull/411"},"issue":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/411"},"comments":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/issues/411/comments"},"review_comments":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411/comments"},"review_comment":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/pulls/411/commits"},"statuses":{"href":"https://api.github.com/repos/Zilliqa/Zilliqa/statuses/819e5db24c721b262c5e376de714b53c4c4abc12"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bb111189"}}