{"action":"created","comment":{"url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments/193391473","pull_request_review_id":126351663,"id":193391473,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzM5MTQ3Mw==","diff_hunk":"@@ -0,0 +1,73 @@\n+use jsonrpc::futures::{Poll, Async};\n+use jsonrpc::futures::stream::{Stream, Fuse};\n+\n+pub trait SelectBothExt: Stream {\n+\tfn select_both<S>(self, other: S) -> SelectBoth<Self, S>\n+\twhere S: Stream<Item = Self::Item, Error = Self::Error>, Self: Sized;\n+}\n+\n+impl<T> SelectBothExt for T where T: Stream {\n+\tfn select_both<S>(self, other: S) -> SelectBoth<Self, S>\n+\twhere S: Stream<Item = Self::Item, Error = Self::Error>, Self: Sized {\n+\t\tnew(self, other)\n+\t}\n+}\n+\n+/// An adapter for merging the output of two streams.\n+///\n+/// The merged stream produces items from either of the underlying streams as\n+/// they become available, and the streams are polled in a round-robin fashion.\n+/// Errors, however, are not merged: you get at most one error at a time.\n+///\n+/// Finishes when either of the streams stops responding\n+#[derive(Debug)]\n+#[must_use = \"streams do nothing unless polled\"]\n+pub struct SelectBoth<S1, S2> {\n+\tstream1: Fuse<S1>,\n+\tstream2: Fuse<S2>,\n+\tflag: bool,\n+}\n+\n+fn new<S1, S2>(stream1: S1, stream2: S2) -> SelectBoth<S1, S2>\n+\twhere S1: Stream,\n+\t\t  S2: Stream<Item = S1::Item, Error = S1::Error>\n+{\n+\tSelectBoth {\n+\t\tstream1: stream1.fuse(),\n+\t\tstream2: stream2.fuse(),\n+\t\tflag: false,\n+\t}\n+}\n+\n+impl<S1, S2> Stream for SelectBoth<S1, S2>\n+\twhere S1: Stream,\n+\t\t  S2: Stream<Item = S1::Item, Error = S1::Error>\n+{\n+\ttype Item = S1::Item;\n+\ttype Error = S1::Error;\n+\n+\tfn poll(&mut self) -> Poll<Option<S1::Item>, S1::Error> {\n+\t\tlet (a, b) = if self.flag {\n+\t\t\t(&mut self.stream2 as &mut Stream<Item=_, Error=_>,\n+\t\t\t &mut self.stream1 as &mut Stream<Item=_, Error=_>)\n+\t\t} else {\n+\t\t\t(&mut self.stream1 as &mut Stream<Item=_, Error=_>,\n+\t\t\t &mut self.stream2 as &mut Stream<Item=_, Error=_>)\n+\t\t};\n+\t\tself.flag = !self.flag;\n+\n+\t\tmatch a.poll()? {\n+\t\t\tAsync::Ready(Some(item)) => return Ok(Some(item).into()),\n+\t\t\tAsync::Ready(None) => return Ok(None.into()),\n+\t\t\tAsync::NotReady => (),\n+\t\t};\n+\n+\t\tself.flag = !self.flag;\n+\n+\t\tmatch b.poll()? {","path":"ipc/src/select_both.rs","position":67,"original_position":67,"commit_id":"a3e4401f8b640f131a9c15472e45d360d247fad9","original_commit_id":"a3e4401f8b640f131a9c15472e45d360d247fad9","user":{"login":"debris","id":2613714,"node_id":"MDQ6VXNlcjI2MTM3MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2613714?v=4","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"body":"🤦‍♂️ 👍 ","created_at":"2018-06-06T12:29:17Z","updated_at":"2018-06-06T12:29:17Z","html_url":"https://github.com/paritytech/jsonrpc/pull/277#discussion_r193391473","pull_request_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments/193391473"},"html":{"href":"https://github.com/paritytech/jsonrpc/pull/277#discussion_r193391473"},"pull_request":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277"}},"in_reply_to_id":193391258},"pull_request":{"url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277","id":192991979,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyOTkxOTc5","html_url":"https://github.com/paritytech/jsonrpc/pull/277","diff_url":"https://github.com/paritytech/jsonrpc/pull/277.diff","patch_url":"https://github.com/paritytech/jsonrpc/pull/277.patch","issue_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/277","number":277,"state":"open","locked":false,"title":"fixed ipc leak","user":{"login":"debris","id":2613714,"node_id":"MDQ6VXNlcjI2MTM3MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2613714?v=4","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"body":"closes #275 \r\ncloses https://github.com/paritytech/parity/issues/8774\r\ncloses https://github.com/paritytech/parity/issues/8618\r\n\r\nThe leak existed, cause we were merging incoming message responses stream with outgoing messages. If either of them existed, we were not dropping a connection.\r\n\r\nTo fix the issue, we finish the merged stream as soon as one of the merged streams ends.","created_at":"2018-06-06T12:09:10Z","updated_at":"2018-06-06T12:29:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"371130974b7f3809eb09e8831a01da1fa7e3db14","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/commits","review_comments_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/comments","review_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/277/comments","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/a3e4401f8b640f131a9c15472e45d360d247fad9","head":{"label":"paritytech:fixed_ipc_leak","ref":"fixed_ipc_leak","sha":"a3e4401f8b640f131a9c15472e45d360d247fad9","user":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"repo":{"id":74377848,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM3Nzg0OA==","name":"jsonrpc","full_name":"paritytech/jsonrpc","owner":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paritytech/jsonrpc","description":"Rust JSON-RPC implementation","fork":false,"url":"https://api.github.com/repos/paritytech/jsonrpc","forks_url":"https://api.github.com/repos/paritytech/jsonrpc/forks","keys_url":"https://api.github.com/repos/paritytech/jsonrpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paritytech/jsonrpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paritytech/jsonrpc/teams","hooks_url":"https://api.github.com/repos/paritytech/jsonrpc/hooks","issue_events_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/events{/number}","events_url":"https://api.github.com/repos/paritytech/jsonrpc/events","assignees_url":"https://api.github.com/repos/paritytech/jsonrpc/assignees{/user}","branches_url":"https://api.github.com/repos/paritytech/jsonrpc/branches{/branch}","tags_url":"https://api.github.com/repos/paritytech/jsonrpc/tags","blobs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paritytech/jsonrpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/paritytech/jsonrpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/{sha}","languages_url":"https://api.github.com/repos/paritytech/jsonrpc/languages","stargazers_url":"https://api.github.com/repos/paritytech/jsonrpc/stargazers","contributors_url":"https://api.github.com/repos/paritytech/jsonrpc/contributors","subscribers_url":"https://api.github.com/repos/paritytech/jsonrpc/subscribers","subscription_url":"https://api.github.com/repos/paritytech/jsonrpc/subscription","commits_url":"https://api.github.com/repos/paritytech/jsonrpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/paritytech/jsonrpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/paritytech/jsonrpc/contents/{+path}","compare_url":"https://api.github.com/repos/paritytech/jsonrpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paritytech/jsonrpc/merges","archive_url":"https://api.github.com/repos/paritytech/jsonrpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paritytech/jsonrpc/downloads","issues_url":"https://api.github.com/repos/paritytech/jsonrpc/issues{/number}","pulls_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls{/number}","milestones_url":"https://api.github.com/repos/paritytech/jsonrpc/milestones{/number}","notifications_url":"https://api.github.com/repos/paritytech/jsonrpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paritytech/jsonrpc/labels{/name}","releases_url":"https://api.github.com/repos/paritytech/jsonrpc/releases{/id}","deployments_url":"https://api.github.com/repos/paritytech/jsonrpc/deployments","created_at":"2016-11-21T15:32:15Z","updated_at":"2018-06-05T16:08:27Z","pushed_at":"2018-06-06T12:09:11Z","git_url":"git://github.com/paritytech/jsonrpc.git","ssh_url":"git@github.com:paritytech/jsonrpc.git","clone_url":"https://github.com/paritytech/jsonrpc.git","svn_url":"https://github.com/paritytech/jsonrpc","homepage":"","size":2386,"stargazers_count":123,"watchers_count":123,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":39,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":39,"watchers":123,"default_branch":"master"}},"base":{"label":"paritytech:master","ref":"master","sha":"3e358b48b71bf90dc60b4099de47e65b030dc319","user":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"repo":{"id":74377848,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM3Nzg0OA==","name":"jsonrpc","full_name":"paritytech/jsonrpc","owner":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paritytech/jsonrpc","description":"Rust JSON-RPC implementation","fork":false,"url":"https://api.github.com/repos/paritytech/jsonrpc","forks_url":"https://api.github.com/repos/paritytech/jsonrpc/forks","keys_url":"https://api.github.com/repos/paritytech/jsonrpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paritytech/jsonrpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paritytech/jsonrpc/teams","hooks_url":"https://api.github.com/repos/paritytech/jsonrpc/hooks","issue_events_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/events{/number}","events_url":"https://api.github.com/repos/paritytech/jsonrpc/events","assignees_url":"https://api.github.com/repos/paritytech/jsonrpc/assignees{/user}","branches_url":"https://api.github.com/repos/paritytech/jsonrpc/branches{/branch}","tags_url":"https://api.github.com/repos/paritytech/jsonrpc/tags","blobs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paritytech/jsonrpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/paritytech/jsonrpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/{sha}","languages_url":"https://api.github.com/repos/paritytech/jsonrpc/languages","stargazers_url":"https://api.github.com/repos/paritytech/jsonrpc/stargazers","contributors_url":"https://api.github.com/repos/paritytech/jsonrpc/contributors","subscribers_url":"https://api.github.com/repos/paritytech/jsonrpc/subscribers","subscription_url":"https://api.github.com/repos/paritytech/jsonrpc/subscription","commits_url":"https://api.github.com/repos/paritytech/jsonrpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/paritytech/jsonrpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/paritytech/jsonrpc/contents/{+path}","compare_url":"https://api.github.com/repos/paritytech/jsonrpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paritytech/jsonrpc/merges","archive_url":"https://api.github.com/repos/paritytech/jsonrpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paritytech/jsonrpc/downloads","issues_url":"https://api.github.com/repos/paritytech/jsonrpc/issues{/number}","pulls_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls{/number}","milestones_url":"https://api.github.com/repos/paritytech/jsonrpc/milestones{/number}","notifications_url":"https://api.github.com/repos/paritytech/jsonrpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paritytech/jsonrpc/labels{/name}","releases_url":"https://api.github.com/repos/paritytech/jsonrpc/releases{/id}","deployments_url":"https://api.github.com/repos/paritytech/jsonrpc/deployments","created_at":"2016-11-21T15:32:15Z","updated_at":"2018-06-05T16:08:27Z","pushed_at":"2018-06-06T12:09:11Z","git_url":"git://github.com/paritytech/jsonrpc.git","ssh_url":"git@github.com:paritytech/jsonrpc.git","clone_url":"https://github.com/paritytech/jsonrpc.git","svn_url":"https://github.com/paritytech/jsonrpc","homepage":"","size":2386,"stargazers_count":123,"watchers_count":123,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":39,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":39,"watchers":123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277"},"html":{"href":"https://github.com/paritytech/jsonrpc/pull/277"},"issue":{"href":"https://api.github.com/repos/paritytech/jsonrpc/issues/277"},"comments":{"href":"https://api.github.com/repos/paritytech/jsonrpc/issues/277/comments"},"review_comments":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/comments"},"review_comment":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/commits"},"statuses":{"href":"https://api.github.com/repos/paritytech/jsonrpc/statuses/a3e4401f8b640f131a9c15472e45d360d247fad9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"debris"}}