{"action":"created","comment":{"url":"https://api.github.com/repos/tox-rs/tox/pulls/comments/207248395","pull_request_review_id":142820959,"id":207248395,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzI0ODM5NQ==","diff_hunk":"@@ -570,28 +569,33 @@ impl Server {\n         }\n     }\n \n-    /// Send UDP packet to specified address. The packet will be dropped if IPv6\n-    /// mode is disabled but the address is IPv6 address.\n-    fn send_to(&self, addr: SocketAddr, packet: DhtPacket) -> IoFuture<()> {\n-        if self.is_ipv6_mode {\n-            match addr.ip() {\n-                IpAddr::V4(ip) => {\n-                    let ip_v6 = ip.to_ipv6_mapped();\n-                    let addr = SocketAddr::new(IpAddr::V6(ip_v6), addr.port());\n-                    send_to(&self.tx, (packet, addr))\n-                },\n-                IpAddr::V6(_ip) => {\n-                    send_to(&self.tx, (packet, addr))\n-                },\n-            }\n-        } else {\n-            if addr.is_ipv4() {\n-                send_to(&self.tx, (packet, addr))\n-            } else {\n-                debug!(\"Attempting to send packet to IPv6 address wile DHT node is running in IPv4 mode\");\n-                Box::new(future::ok(()))\n-            }\n+    /// Send UDP packet node. If the node has both IPv4 and IPv6 addresses,\n+    /// then it sends packet to both addresses.\n+    fn send_to(&self, node: &DhtNode, packet: DhtPacket) -> IoFuture<()> {\n+        let mut futures = Vec::new();\n+\n+        if self.is_ipv6_mode {// DHT node is running in ipv6 mode\n+            if let Some(sock_v6) = node.saddr_v6 {\n+                futures.push(send_to(&self.tx, (packet.clone(), SocketAddr::V6(sock_v6))));\n+            } else {};\n+\n+            if let Some(sock_v4) = node.saddr_v4 {\n+                let ip_v6 = sock_v4.ip().to_ipv6_mapped();\n+                let addr = SocketAddr::new(IpAddr::V6(ip_v6), sock_v4.port());\n+                futures.push(send_to(&self.tx, (packet, addr)));\n+            } else {};\n+        } else { // DHT node is running in ipv4 mode\n+            if let Some(sock_v4) = node.saddr_v4 {\n+                futures.push(send_to(&self.tx, (packet, SocketAddr::V4(sock_v4))));\n+            } else {};","path":"src/toxcore/dht/server/mod.rs","position":143,"original_position":143,"commit_id":"588410a1d88615d0ccf5de1256ddd9cb1c34be2c","original_commit_id":"588410a1d88615d0ccf5de1256ddd9cb1c34be2c","user":{"login":"kurnevsky","id":2943605,"node_id":"MDQ6VXNlcjI5NDM2MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/2943605?v=4","gravatar_id":"","url":"https://api.github.com/users/kurnevsky","html_url":"https://github.com/kurnevsky","followers_url":"https://api.github.com/users/kurnevsky/followers","following_url":"https://api.github.com/users/kurnevsky/following{/other_user}","gists_url":"https://api.github.com/users/kurnevsky/gists{/gist_id}","starred_url":"https://api.github.com/users/kurnevsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurnevsky/subscriptions","organizations_url":"https://api.github.com/users/kurnevsky/orgs","repos_url":"https://api.github.com/users/kurnevsky/repos","events_url":"https://api.github.com/users/kurnevsky/events{/privacy}","received_events_url":"https://api.github.com/users/kurnevsky/received_events","type":"User","site_admin":false},"body":"Remove empty else block.","created_at":"2018-08-02T14:30:26Z","updated_at":"2018-08-02T14:30:26Z","html_url":"https://github.com/tox-rs/tox/pull/181#discussion_r207248395","pull_request_url":"https://api.github.com/repos/tox-rs/tox/pulls/181","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/comments/207248395"},"html":{"href":"https://github.com/tox-rs/tox/pull/181#discussion_r207248395"},"pull_request":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/181"}}},"pull_request":{"url":"https://api.github.com/repos/tox-rs/tox/pulls/181","id":204694526,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0Njk0NTI2","html_url":"https://github.com/tox-rs/tox/pull/181","diff_url":"https://github.com/tox-rs/tox/pull/181.diff","patch_url":"https://github.com/tox-rs/tox/pull/181.patch","issue_url":"https://api.github.com/repos/tox-rs/tox/issues/181","number":181,"state":"open","locked":false,"title":"Use DhtNode instead of PackedNode","user":{"login":"NamsooCho","id":10192129,"node_id":"MDQ6VXNlcjEwMTkyMTI5","avatar_url":"https://avatars1.githubusercontent.com/u/10192129?v=4","gravatar_id":"","url":"https://api.github.com/users/NamsooCho","html_url":"https://github.com/NamsooCho","followers_url":"https://api.github.com/users/NamsooCho/followers","following_url":"https://api.github.com/users/NamsooCho/following{/other_user}","gists_url":"https://api.github.com/users/NamsooCho/gists{/gist_id}","starred_url":"https://api.github.com/users/NamsooCho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NamsooCho/subscriptions","organizations_url":"https://api.github.com/users/NamsooCho/orgs","repos_url":"https://api.github.com/users/NamsooCho/repos","events_url":"https://api.github.com/users/NamsooCho/events{/privacy}","received_events_url":"https://api.github.com/users/NamsooCho/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-30T05:00:01Z","updated_at":"2018-08-02T14:30:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60942071cf38e47193778d2101e2e563d14890ed","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tox-rs/tox/pulls/181/commits","review_comments_url":"https://api.github.com/repos/tox-rs/tox/pulls/181/comments","review_comment_url":"https://api.github.com/repos/tox-rs/tox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tox-rs/tox/issues/181/comments","statuses_url":"https://api.github.com/repos/tox-rs/tox/statuses/588410a1d88615d0ccf5de1256ddd9cb1c34be2c","head":{"label":"tox-rs:dht_node","ref":"dht_node","sha":"588410a1d88615d0ccf5de1256ddd9cb1c34be2c","user":{"login":"tox-rs","id":35774911,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzc0OTEx","avatar_url":"https://avatars2.githubusercontent.com/u/35774911?v=4","gravatar_id":"","url":"https://api.github.com/users/tox-rs","html_url":"https://github.com/tox-rs","followers_url":"https://api.github.com/users/tox-rs/followers","following_url":"https://api.github.com/users/tox-rs/following{/other_user}","gists_url":"https://api.github.com/users/tox-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tox-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tox-rs/subscriptions","organizations_url":"https://api.github.com/users/tox-rs/orgs","repos_url":"https://api.github.com/users/tox-rs/repos","events_url":"https://api.github.com/users/tox-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tox-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":118792123,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg3OTIxMjM=","name":"tox","full_name":"tox-rs/tox","owner":{"login":"tox-rs","id":35774911,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzc0OTEx","avatar_url":"https://avatars2.githubusercontent.com/u/35774911?v=4","gravatar_id":"","url":"https://api.github.com/users/tox-rs","html_url":"https://github.com/tox-rs","followers_url":"https://api.github.com/users/tox-rs/followers","following_url":"https://api.github.com/users/tox-rs/following{/other_user}","gists_url":"https://api.github.com/users/tox-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tox-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tox-rs/subscriptions","organizations_url":"https://api.github.com/users/tox-rs/orgs","repos_url":"https://api.github.com/users/tox-rs/repos","events_url":"https://api.github.com/users/tox-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tox-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tox-rs/tox","description":"toxcore implementation in Rust","fork":false,"url":"https://api.github.com/repos/tox-rs/tox","forks_url":"https://api.github.com/repos/tox-rs/tox/forks","keys_url":"https://api.github.com/repos/tox-rs/tox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tox-rs/tox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tox-rs/tox/teams","hooks_url":"https://api.github.com/repos/tox-rs/tox/hooks","issue_events_url":"https://api.github.com/repos/tox-rs/tox/issues/events{/number}","events_url":"https://api.github.com/repos/tox-rs/tox/events","assignees_url":"https://api.github.com/repos/tox-rs/tox/assignees{/user}","branches_url":"https://api.github.com/repos/tox-rs/tox/branches{/branch}","tags_url":"https://api.github.com/repos/tox-rs/tox/tags","blobs_url":"https://api.github.com/repos/tox-rs/tox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tox-rs/tox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tox-rs/tox/git/refs{/sha}","trees_url":"https://api.github.com/repos/tox-rs/tox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tox-rs/tox/statuses/{sha}","languages_url":"https://api.github.com/repos/tox-rs/tox/languages","stargazers_url":"https://api.github.com/repos/tox-rs/tox/stargazers","contributors_url":"https://api.github.com/repos/tox-rs/tox/contributors","subscribers_url":"https://api.github.com/repos/tox-rs/tox/subscribers","subscription_url":"https://api.github.com/repos/tox-rs/tox/subscription","commits_url":"https://api.github.com/repos/tox-rs/tox/commits{/sha}","git_commits_url":"https://api.github.com/repos/tox-rs/tox/git/commits{/sha}","comments_url":"https://api.github.com/repos/tox-rs/tox/comments{/number}","issue_comment_url":"https://api.github.com/repos/tox-rs/tox/issues/comments{/number}","contents_url":"https://api.github.com/repos/tox-rs/tox/contents/{+path}","compare_url":"https://api.github.com/repos/tox-rs/tox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tox-rs/tox/merges","archive_url":"https://api.github.com/repos/tox-rs/tox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tox-rs/tox/downloads","issues_url":"https://api.github.com/repos/tox-rs/tox/issues{/number}","pulls_url":"https://api.github.com/repos/tox-rs/tox/pulls{/number}","milestones_url":"https://api.github.com/repos/tox-rs/tox/milestones{/number}","notifications_url":"https://api.github.com/repos/tox-rs/tox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tox-rs/tox/labels{/name}","releases_url":"https://api.github.com/repos/tox-rs/tox/releases{/id}","deployments_url":"https://api.github.com/repos/tox-rs/tox/deployments","created_at":"2018-01-24T16:35:53Z","updated_at":"2018-08-01T19:51:45Z","pushed_at":"2018-08-02T10:23:24Z","git_url":"git://github.com/tox-rs/tox.git","ssh_url":"git@github.com:tox-rs/tox.git","clone_url":"https://github.com/tox-rs/tox.git","svn_url":"https://github.com/tox-rs/tox","homepage":"","size":2264,"stargazers_count":85,"watchers_count":85,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":3,"open_issues":15,"watchers":85,"default_branch":"master"}},"base":{"label":"tox-rs:master","ref":"master","sha":"168a5628047a236073af64a2153d5b7f0fc712f0","user":{"login":"tox-rs","id":35774911,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzc0OTEx","avatar_url":"https://avatars2.githubusercontent.com/u/35774911?v=4","gravatar_id":"","url":"https://api.github.com/users/tox-rs","html_url":"https://github.com/tox-rs","followers_url":"https://api.github.com/users/tox-rs/followers","following_url":"https://api.github.com/users/tox-rs/following{/other_user}","gists_url":"https://api.github.com/users/tox-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tox-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tox-rs/subscriptions","organizations_url":"https://api.github.com/users/tox-rs/orgs","repos_url":"https://api.github.com/users/tox-rs/repos","events_url":"https://api.github.com/users/tox-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tox-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":118792123,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg3OTIxMjM=","name":"tox","full_name":"tox-rs/tox","owner":{"login":"tox-rs","id":35774911,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1Nzc0OTEx","avatar_url":"https://avatars2.githubusercontent.com/u/35774911?v=4","gravatar_id":"","url":"https://api.github.com/users/tox-rs","html_url":"https://github.com/tox-rs","followers_url":"https://api.github.com/users/tox-rs/followers","following_url":"https://api.github.com/users/tox-rs/following{/other_user}","gists_url":"https://api.github.com/users/tox-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/tox-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tox-rs/subscriptions","organizations_url":"https://api.github.com/users/tox-rs/orgs","repos_url":"https://api.github.com/users/tox-rs/repos","events_url":"https://api.github.com/users/tox-rs/events{/privacy}","received_events_url":"https://api.github.com/users/tox-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tox-rs/tox","description":"toxcore implementation in Rust","fork":false,"url":"https://api.github.com/repos/tox-rs/tox","forks_url":"https://api.github.com/repos/tox-rs/tox/forks","keys_url":"https://api.github.com/repos/tox-rs/tox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tox-rs/tox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tox-rs/tox/teams","hooks_url":"https://api.github.com/repos/tox-rs/tox/hooks","issue_events_url":"https://api.github.com/repos/tox-rs/tox/issues/events{/number}","events_url":"https://api.github.com/repos/tox-rs/tox/events","assignees_url":"https://api.github.com/repos/tox-rs/tox/assignees{/user}","branches_url":"https://api.github.com/repos/tox-rs/tox/branches{/branch}","tags_url":"https://api.github.com/repos/tox-rs/tox/tags","blobs_url":"https://api.github.com/repos/tox-rs/tox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tox-rs/tox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tox-rs/tox/git/refs{/sha}","trees_url":"https://api.github.com/repos/tox-rs/tox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tox-rs/tox/statuses/{sha}","languages_url":"https://api.github.com/repos/tox-rs/tox/languages","stargazers_url":"https://api.github.com/repos/tox-rs/tox/stargazers","contributors_url":"https://api.github.com/repos/tox-rs/tox/contributors","subscribers_url":"https://api.github.com/repos/tox-rs/tox/subscribers","subscription_url":"https://api.github.com/repos/tox-rs/tox/subscription","commits_url":"https://api.github.com/repos/tox-rs/tox/commits{/sha}","git_commits_url":"https://api.github.com/repos/tox-rs/tox/git/commits{/sha}","comments_url":"https://api.github.com/repos/tox-rs/tox/comments{/number}","issue_comment_url":"https://api.github.com/repos/tox-rs/tox/issues/comments{/number}","contents_url":"https://api.github.com/repos/tox-rs/tox/contents/{+path}","compare_url":"https://api.github.com/repos/tox-rs/tox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tox-rs/tox/merges","archive_url":"https://api.github.com/repos/tox-rs/tox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tox-rs/tox/downloads","issues_url":"https://api.github.com/repos/tox-rs/tox/issues{/number}","pulls_url":"https://api.github.com/repos/tox-rs/tox/pulls{/number}","milestones_url":"https://api.github.com/repos/tox-rs/tox/milestones{/number}","notifications_url":"https://api.github.com/repos/tox-rs/tox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tox-rs/tox/labels{/name}","releases_url":"https://api.github.com/repos/tox-rs/tox/releases{/id}","deployments_url":"https://api.github.com/repos/tox-rs/tox/deployments","created_at":"2018-01-24T16:35:53Z","updated_at":"2018-08-01T19:51:45Z","pushed_at":"2018-08-02T10:23:24Z","git_url":"git://github.com/tox-rs/tox.git","ssh_url":"git@github.com:tox-rs/tox.git","clone_url":"https://github.com/tox-rs/tox.git","svn_url":"https://github.com/tox-rs/tox","homepage":"","size":2264,"stargazers_count":85,"watchers_count":85,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":3,"open_issues":15,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/181"},"html":{"href":"https://github.com/tox-rs/tox/pull/181"},"issue":{"href":"https://api.github.com/repos/tox-rs/tox/issues/181"},"comments":{"href":"https://api.github.com/repos/tox-rs/tox/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tox-rs/tox/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/tox-rs/tox/statuses/588410a1d88615d0ccf5de1256ddd9cb1c34be2c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kurnevsky"}}