{"action":"created","comment":{"url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments/229376923","pull_request_review_id":169863751,"id":229376923,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTM3NjkyMw==","diff_hunk":"@@ -0,0 +1,142 @@\n+// Copyright 2018 Parity Technologies (UK) Ltd.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a\n+// copy of this software and associated documentation files (the \"Software\"),\n+// to deal in the Software without restriction, including without limitation\n+// the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+// and/or sell copies of the Software, and to permit persons to whom the\n+// Software is furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+// DEALINGS IN THE SOFTWARE.\n+\n+use arrayvec::ArrayVec;\n+use futures::prelude::*;\n+use libp2p_core::{\n+    nodes::{NodeHandlerEndpoint, ProtocolsHandler, ProtocolsHandlerEvent},\n+    ConnectionUpgrade,\n+};\n+use protocol::{Ping, PingListener, PingOutput};\n+use std::io;\n+use tokio_io::{AsyncRead, AsyncWrite};\n+use void::Void;\n+\n+/// Handler for handling pings received from a remote.\n+pub struct PingListenHandler<TSubstream> {\n+    /// Configuration for the ping protocol.\n+    ping_config: Ping<()>,\n+\n+    /// The ping substreams that were opened by the remote.\n+    /// Note that we only accept a certain number of substreams, after which we refuse new ones\n+    /// to avoid being DDoSed.\n+    ping_in_substreams: ArrayVec<[PingListener<TSubstream>; 8]>,","path":"protocols/ping/src/listen_handler.rs","position":40,"original_position":40,"commit_id":"7a8437e32b21bb42030241927fd803e60cff3210","original_commit_id":"f30e436683d76859a4ed17da23410b6b826c31cd","user":{"login":"twittner","id":132165,"node_id":"MDQ6VXNlcjEzMjE2NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/132165?v=4","gravatar_id":"","url":"https://api.github.com/users/twittner","html_url":"https://github.com/twittner","followers_url":"https://api.github.com/users/twittner/followers","following_url":"https://api.github.com/users/twittner/following{/other_user}","gists_url":"https://api.github.com/users/twittner/gists{/gist_id}","starred_url":"https://api.github.com/users/twittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twittner/subscriptions","organizations_url":"https://api.github.com/users/twittner/orgs","repos_url":"https://api.github.com/users/twittner/repos","events_url":"https://api.github.com/users/twittner/events{/privacy}","received_events_url":"https://api.github.com/users/twittner/received_events","type":"User","site_admin":false},"body":"Yes, but the muxer probably limits the number of streams per connection anyway on a level the system can handle.","created_at":"2018-10-30T16:16:20Z","updated_at":"2018-10-30T16:16:20Z","html_url":"https://github.com/libp2p/rust-libp2p/pull/574#discussion_r229376923","pull_request_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments/229376923"},"html":{"href":"https://github.com/libp2p/rust-libp2p/pull/574#discussion_r229376923"},"pull_request":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574"}},"in_reply_to_id":229263401},"pull_request":{"url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574","id":223993352,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzOTkzMzUy","html_url":"https://github.com/libp2p/rust-libp2p/pull/574","diff_url":"https://github.com/libp2p/rust-libp2p/pull/574.diff","patch_url":"https://github.com/libp2p/rust-libp2p/pull/574.patch","issue_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/574","number":574,"state":"open","locked":false,"title":"Add a PeriodicPingHandler and a PingListenHandler","user":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"body":"Based on #573 \r\n\r\nRenames `ping/src/lib.rs` to `ping/src/protocol.rs`, which is why the diff is so large.\r\n\r\nAdds an implementation of `ProtocolsHandler` that handles incoming ping substreams, and an implementation of `ProtocolsHandler` that periodically pings the remote and disconnects us if it doesn't respond in time or doesn't support ping.\r\n","created_at":"2018-10-18T15:06:33Z","updated_at":"2018-10-30T16:16:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bc091765da6ae3f60a6ab5fccde8b6255d27e22","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574/commits","review_comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574/comments","review_comment_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/574/comments","statuses_url":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/7a8437e32b21bb42030241927fd803e60cff3210","head":{"label":"tomaka:ping-proto-handler","ref":"ping-proto-handler","sha":"7a8437e32b21bb42030241927fd803e60cff3210","user":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"repo":{"id":110135073,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxMzUwNzM=","name":"libp2p-rs","full_name":"tomaka/libp2p-rs","private":false,"owner":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tomaka/libp2p-rs","description":"LibP2P networking library written in Rust","fork":true,"url":"https://api.github.com/repos/tomaka/libp2p-rs","forks_url":"https://api.github.com/repos/tomaka/libp2p-rs/forks","keys_url":"https://api.github.com/repos/tomaka/libp2p-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomaka/libp2p-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomaka/libp2p-rs/teams","hooks_url":"https://api.github.com/repos/tomaka/libp2p-rs/hooks","issue_events_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues/events{/number}","events_url":"https://api.github.com/repos/tomaka/libp2p-rs/events","assignees_url":"https://api.github.com/repos/tomaka/libp2p-rs/assignees{/user}","branches_url":"https://api.github.com/repos/tomaka/libp2p-rs/branches{/branch}","tags_url":"https://api.github.com/repos/tomaka/libp2p-rs/tags","blobs_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomaka/libp2p-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/tomaka/libp2p-rs/languages","stargazers_url":"https://api.github.com/repos/tomaka/libp2p-rs/stargazers","contributors_url":"https://api.github.com/repos/tomaka/libp2p-rs/contributors","subscribers_url":"https://api.github.com/repos/tomaka/libp2p-rs/subscribers","subscription_url":"https://api.github.com/repos/tomaka/libp2p-rs/subscription","commits_url":"https://api.github.com/repos/tomaka/libp2p-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomaka/libp2p-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomaka/libp2p-rs/contents/{+path}","compare_url":"https://api.github.com/repos/tomaka/libp2p-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomaka/libp2p-rs/merges","archive_url":"https://api.github.com/repos/tomaka/libp2p-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomaka/libp2p-rs/downloads","issues_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues{/number}","pulls_url":"https://api.github.com/repos/tomaka/libp2p-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/tomaka/libp2p-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/tomaka/libp2p-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomaka/libp2p-rs/labels{/name}","releases_url":"https://api.github.com/repos/tomaka/libp2p-rs/releases{/id}","deployments_url":"https://api.github.com/repos/tomaka/libp2p-rs/deployments","created_at":"2017-11-09T15:51:30Z","updated_at":"2018-08-21T14:18:19Z","pushed_at":"2018-10-30T07:24:10Z","git_url":"git://github.com/tomaka/libp2p-rs.git","ssh_url":"git@github.com:tomaka/libp2p-rs.git","clone_url":"https://github.com/tomaka/libp2p-rs.git","svn_url":"https://github.com/tomaka/libp2p-rs","homepage":"","size":2686,"stargazers_count":8,"watchers_count":8,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":0,"watchers":8,"default_branch":"master"}},"base":{"label":"libp2p:master","ref":"master","sha":"1e223f627dba3e29b4313ba44f2afa608cc7b385","user":{"login":"libp2p","id":14838238,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODM4MjM4","avatar_url":"https://avatars3.githubusercontent.com/u/14838238?v=4","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":86106381,"node_id":"MDEwOlJlcG9zaXRvcnk4NjEwNjM4MQ==","name":"rust-libp2p","full_name":"libp2p/rust-libp2p","private":false,"owner":{"login":"libp2p","id":14838238,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODM4MjM4","avatar_url":"https://avatars3.githubusercontent.com/u/14838238?v=4","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/libp2p/rust-libp2p","description":"The Rust Implementation of libp2p networking stack. ","fork":false,"url":"https://api.github.com/repos/libp2p/rust-libp2p","forks_url":"https://api.github.com/repos/libp2p/rust-libp2p/forks","keys_url":"https://api.github.com/repos/libp2p/rust-libp2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/rust-libp2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/rust-libp2p/teams","hooks_url":"https://api.github.com/repos/libp2p/rust-libp2p/hooks","issue_events_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/rust-libp2p/events","assignees_url":"https://api.github.com/repos/libp2p/rust-libp2p/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/rust-libp2p/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/rust-libp2p/tags","blobs_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/rust-libp2p/languages","stargazers_url":"https://api.github.com/repos/libp2p/rust-libp2p/stargazers","contributors_url":"https://api.github.com/repos/libp2p/rust-libp2p/contributors","subscribers_url":"https://api.github.com/repos/libp2p/rust-libp2p/subscribers","subscription_url":"https://api.github.com/repos/libp2p/rust-libp2p/subscription","commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/rust-libp2p/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/rust-libp2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/rust-libp2p/merges","archive_url":"https://api.github.com/repos/libp2p/rust-libp2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/rust-libp2p/downloads","issues_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/rust-libp2p/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/rust-libp2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/rust-libp2p/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/rust-libp2p/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/rust-libp2p/deployments","created_at":"2017-03-24T20:05:11Z","updated_at":"2018-10-30T09:48:30Z","pushed_at":"2018-10-30T09:49:51Z","git_url":"git://github.com/libp2p/rust-libp2p.git","ssh_url":"git@github.com:libp2p/rust-libp2p.git","clone_url":"https://github.com/libp2p/rust-libp2p.git","svn_url":"https://github.com/libp2p/rust-libp2p","homepage":"https://libp2p.io","size":2022,"stargazers_count":492,"watchers_count":492,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":122,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":75,"open_issues":122,"watchers":492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574"},"html":{"href":"https://github.com/libp2p/rust-libp2p/pull/574"},"issue":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/issues/574"},"comments":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/issues/574/comments"},"review_comments":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574/comments"},"review_comment":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/574/commits"},"statuses":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/7a8437e32b21bb42030241927fd803e60cff3210"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"twittner"}}