{"action":"created","comment":{"url":"https://api.github.com/repos/zetok/tox/pulls/comments/68925510","id":68925510,"diff_hunk":"@@ -22,29 +22,205 @@\n //! Networking part of the toxcore.\n \n \n-use std::net::UdpSocket;\n+use std::any::Any;\n+use std::rc::Rc;\n+use std::cell::RefCell;\n+use std::io::{ self, ErrorKind };\n+use std::sync::{ Once, ONCE_INIT };\n+use std::ops::{ Range, RangeFrom, RangeTo, RangeFull };\n+use std::net::{ IpAddr, Ipv6Addr, SocketAddr, ToSocketAddrs };\n+use std::collections::HashMap;\n+use mio::udp::UdpSocket;\n+use sodiumoxide;\n \n \n /// Minimum port which Tox will try to bind to.\n pub const PORT_MIN: u16 = 33445;\n /// Maximum port which Tox will try to bind to.\n pub const PORT_MAX: u16 = 33545;\n+/// Maximum size of a UDP packet that tox will handle.\n+pub const MAX_UDP_PACKET_SIZE: usize = 2048;\n+\n+static AT_STARTUP_RAN: Once = ONCE_INIT;\n+\n+/** Run this before creating sockets.\n+\n+    return true on success\n+    return false on failure\n+*/\n+fn networking_at_startup() -> bool {\n+    let mut output = true;\n+    AT_STARTUP_RAN.call_once(|| output = sodiumoxide::init());\n+    output\n+}","path":"src/toxcore/network.rs","position":35,"original_position":35,"commit_id":"e2d63f7c8c3151a2efd05c4a740e90ec7b9cf7f3","original_commit_id":"e2d63f7c8c3151a2efd05c4a740e90ec7b9cf7f3","user":{"login":"quininer","id":6286761,"avatar_url":"https://avatars.githubusercontent.com/u/6286761?v=3","gravatar_id":"","url":"https://api.github.com/users/quininer","html_url":"https://github.com/quininer","followers_url":"https://api.github.com/users/quininer/followers","following_url":"https://api.github.com/users/quininer/following{/other_user}","gists_url":"https://api.github.com/users/quininer/gists{/gist_id}","starred_url":"https://api.github.com/users/quininer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quininer/subscriptions","organizations_url":"https://api.github.com/users/quininer/orgs","repos_url":"https://api.github.com/users/quininer/repos","events_url":"https://api.github.com/users/quininer/events{/privacy}","received_events_url":"https://api.github.com/users/quininer/received_events","type":"User","site_admin":false},"body":"https://github.com/irungentoo/toxcore/blob/master/toxcore/network.c#L439\r\n\r\nI also think that it should not be here, but it should be placed where it?\r\n","created_at":"2016-06-29T10:47:52Z","updated_at":"2016-06-29T10:47:52Z","html_url":"https://github.com/zetok/tox/pull/8#discussion_r68925510","pull_request_url":"https://api.github.com/repos/zetok/tox/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/zetok/tox/pulls/comments/68925510"},"html":{"href":"https://github.com/zetok/tox/pull/8#discussion_r68925510"},"pull_request":{"href":"https://api.github.com/repos/zetok/tox/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/zetok/tox/pulls/8","id":70461916,"html_url":"https://github.com/zetok/tox/pull/8","diff_url":"https://github.com/zetok/tox/pull/8.diff","patch_url":"https://github.com/zetok/tox/pull/8.patch","issue_url":"https://api.github.com/repos/zetok/tox/issues/8","number":8,"state":"open","locked":false,"title":"network mod","user":{"login":"quininer","id":6286761,"avatar_url":"https://avatars.githubusercontent.com/u/6286761?v=3","gravatar_id":"","url":"https://api.github.com/users/quininer","html_url":"https://github.com/quininer","followers_url":"https://api.github.com/users/quininer/followers","following_url":"https://api.github.com/users/quininer/following{/other_user}","gists_url":"https://api.github.com/users/quininer/gists{/gist_id}","starred_url":"https://api.github.com/users/quininer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quininer/subscriptions","organizations_url":"https://api.github.com/users/quininer/orgs","repos_url":"https://api.github.com/users/quininer/repos","events_url":"https://api.github.com/users/quininer/events{/privacy}","received_events_url":"https://api.github.com/users/quininer/received_events","type":"User","site_admin":false},"body":"It lacks documentation and test. @_@","created_at":"2016-05-18T02:51:47Z","updated_at":"2016-06-29T10:47:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8bf79dcf150a3c76242656568c683a8f43944882","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zetok/tox/pulls/8/commits","review_comments_url":"https://api.github.com/repos/zetok/tox/pulls/8/comments","review_comment_url":"https://api.github.com/repos/zetok/tox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zetok/tox/issues/8/comments","statuses_url":"https://api.github.com/repos/zetok/tox/statuses/e2d63f7c8c3151a2efd05c4a740e90ec7b9cf7f3","head":{"label":"quininer:network","ref":"network","sha":"e2d63f7c8c3151a2efd05c4a740e90ec7b9cf7f3","user":{"login":"quininer","id":6286761,"avatar_url":"https://avatars.githubusercontent.com/u/6286761?v=3","gravatar_id":"","url":"https://api.github.com/users/quininer","html_url":"https://github.com/quininer","followers_url":"https://api.github.com/users/quininer/followers","following_url":"https://api.github.com/users/quininer/following{/other_user}","gists_url":"https://api.github.com/users/quininer/gists{/gist_id}","starred_url":"https://api.github.com/users/quininer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quininer/subscriptions","organizations_url":"https://api.github.com/users/quininer/orgs","repos_url":"https://api.github.com/users/quininer/repos","events_url":"https://api.github.com/users/quininer/events{/privacy}","received_events_url":"https://api.github.com/users/quininer/received_events","type":"User","site_admin":false},"repo":{"id":54821753,"name":"tox","full_name":"quininer/tox","owner":{"login":"quininer","id":6286761,"avatar_url":"https://avatars.githubusercontent.com/u/6286761?v=3","gravatar_id":"","url":"https://api.github.com/users/quininer","html_url":"https://github.com/quininer","followers_url":"https://api.github.com/users/quininer/followers","following_url":"https://api.github.com/users/quininer/following{/other_user}","gists_url":"https://api.github.com/users/quininer/gists{/gist_id}","starred_url":"https://api.github.com/users/quininer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quininer/subscriptions","organizations_url":"https://api.github.com/users/quininer/orgs","repos_url":"https://api.github.com/users/quininer/repos","events_url":"https://api.github.com/users/quininer/events{/privacy}","received_events_url":"https://api.github.com/users/quininer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/quininer/tox","description":"toxcore implementation in Rust.","fork":true,"url":"https://api.github.com/repos/quininer/tox","forks_url":"https://api.github.com/repos/quininer/tox/forks","keys_url":"https://api.github.com/repos/quininer/tox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quininer/tox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quininer/tox/teams","hooks_url":"https://api.github.com/repos/quininer/tox/hooks","issue_events_url":"https://api.github.com/repos/quininer/tox/issues/events{/number}","events_url":"https://api.github.com/repos/quininer/tox/events","assignees_url":"https://api.github.com/repos/quininer/tox/assignees{/user}","branches_url":"https://api.github.com/repos/quininer/tox/branches{/branch}","tags_url":"https://api.github.com/repos/quininer/tox/tags","blobs_url":"https://api.github.com/repos/quininer/tox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quininer/tox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quininer/tox/git/refs{/sha}","trees_url":"https://api.github.com/repos/quininer/tox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quininer/tox/statuses/{sha}","languages_url":"https://api.github.com/repos/quininer/tox/languages","stargazers_url":"https://api.github.com/repos/quininer/tox/stargazers","contributors_url":"https://api.github.com/repos/quininer/tox/contributors","subscribers_url":"https://api.github.com/repos/quininer/tox/subscribers","subscription_url":"https://api.github.com/repos/quininer/tox/subscription","commits_url":"https://api.github.com/repos/quininer/tox/commits{/sha}","git_commits_url":"https://api.github.com/repos/quininer/tox/git/commits{/sha}","comments_url":"https://api.github.com/repos/quininer/tox/comments{/number}","issue_comment_url":"https://api.github.com/repos/quininer/tox/issues/comments{/number}","contents_url":"https://api.github.com/repos/quininer/tox/contents/{+path}","compare_url":"https://api.github.com/repos/quininer/tox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quininer/tox/merges","archive_url":"https://api.github.com/repos/quininer/tox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quininer/tox/downloads","issues_url":"https://api.github.com/repos/quininer/tox/issues{/number}","pulls_url":"https://api.github.com/repos/quininer/tox/pulls{/number}","milestones_url":"https://api.github.com/repos/quininer/tox/milestones{/number}","notifications_url":"https://api.github.com/repos/quininer/tox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quininer/tox/labels{/name}","releases_url":"https://api.github.com/repos/quininer/tox/releases{/id}","deployments_url":"https://api.github.com/repos/quininer/tox/deployments","created_at":"2016-03-27T09:38:18Z","updated_at":"2016-03-27T09:38:19Z","pushed_at":"2016-06-13T11:26:51Z","git_url":"git://github.com/quininer/tox.git","ssh_url":"git@github.com:quininer/tox.git","clone_url":"https://github.com/quininer/tox.git","svn_url":"https://github.com/quininer/tox","homepage":"https://zetok.github.io/tox","size":1800,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"zetok:master","ref":"master","sha":"5f0b226a9d1fd84969a87a453bd7b87dc4db41ce","user":{"login":"zetok","id":3148759,"avatar_url":"https://avatars.githubusercontent.com/u/3148759?v=3","gravatar_id":"","url":"https://api.github.com/users/zetok","html_url":"https://github.com/zetok","followers_url":"https://api.github.com/users/zetok/followers","following_url":"https://api.github.com/users/zetok/following{/other_user}","gists_url":"https://api.github.com/users/zetok/gists{/gist_id}","starred_url":"https://api.github.com/users/zetok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zetok/subscriptions","organizations_url":"https://api.github.com/users/zetok/orgs","repos_url":"https://api.github.com/users/zetok/repos","events_url":"https://api.github.com/users/zetok/events{/privacy}","received_events_url":"https://api.github.com/users/zetok/received_events","type":"User","site_admin":false},"repo":{"id":51173610,"name":"tox","full_name":"zetok/tox","owner":{"login":"zetok","id":3148759,"avatar_url":"https://avatars.githubusercontent.com/u/3148759?v=3","gravatar_id":"","url":"https://api.github.com/users/zetok","html_url":"https://github.com/zetok","followers_url":"https://api.github.com/users/zetok/followers","following_url":"https://api.github.com/users/zetok/following{/other_user}","gists_url":"https://api.github.com/users/zetok/gists{/gist_id}","starred_url":"https://api.github.com/users/zetok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zetok/subscriptions","organizations_url":"https://api.github.com/users/zetok/orgs","repos_url":"https://api.github.com/users/zetok/repos","events_url":"https://api.github.com/users/zetok/events{/privacy}","received_events_url":"https://api.github.com/users/zetok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zetok/tox","description":"toxcore implementation in Rust.","fork":false,"url":"https://api.github.com/repos/zetok/tox","forks_url":"https://api.github.com/repos/zetok/tox/forks","keys_url":"https://api.github.com/repos/zetok/tox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zetok/tox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zetok/tox/teams","hooks_url":"https://api.github.com/repos/zetok/tox/hooks","issue_events_url":"https://api.github.com/repos/zetok/tox/issues/events{/number}","events_url":"https://api.github.com/repos/zetok/tox/events","assignees_url":"https://api.github.com/repos/zetok/tox/assignees{/user}","branches_url":"https://api.github.com/repos/zetok/tox/branches{/branch}","tags_url":"https://api.github.com/repos/zetok/tox/tags","blobs_url":"https://api.github.com/repos/zetok/tox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zetok/tox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zetok/tox/git/refs{/sha}","trees_url":"https://api.github.com/repos/zetok/tox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zetok/tox/statuses/{sha}","languages_url":"https://api.github.com/repos/zetok/tox/languages","stargazers_url":"https://api.github.com/repos/zetok/tox/stargazers","contributors_url":"https://api.github.com/repos/zetok/tox/contributors","subscribers_url":"https://api.github.com/repos/zetok/tox/subscribers","subscription_url":"https://api.github.com/repos/zetok/tox/subscription","commits_url":"https://api.github.com/repos/zetok/tox/commits{/sha}","git_commits_url":"https://api.github.com/repos/zetok/tox/git/commits{/sha}","comments_url":"https://api.github.com/repos/zetok/tox/comments{/number}","issue_comment_url":"https://api.github.com/repos/zetok/tox/issues/comments{/number}","contents_url":"https://api.github.com/repos/zetok/tox/contents/{+path}","compare_url":"https://api.github.com/repos/zetok/tox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zetok/tox/merges","archive_url":"https://api.github.com/repos/zetok/tox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zetok/tox/downloads","issues_url":"https://api.github.com/repos/zetok/tox/issues{/number}","pulls_url":"https://api.github.com/repos/zetok/tox/pulls{/number}","milestones_url":"https://api.github.com/repos/zetok/tox/milestones{/number}","notifications_url":"https://api.github.com/repos/zetok/tox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zetok/tox/labels{/name}","releases_url":"https://api.github.com/repos/zetok/tox/releases{/id}","deployments_url":"https://api.github.com/repos/zetok/tox/deployments","created_at":"2016-02-05T20:58:47Z","updated_at":"2016-06-27T14:30:53Z","pushed_at":"2016-06-22T22:36:41Z","git_url":"git://github.com/zetok/tox.git","ssh_url":"git@github.com:zetok/tox.git","clone_url":"https://github.com/zetok/tox.git","svn_url":"https://github.com/zetok/tox","homepage":"https://zetok.github.io/tox","size":1947,"stargazers_count":32,"watchers_count":32,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zetok/tox/pulls/8"},"html":{"href":"https://github.com/zetok/tox/pull/8"},"issue":{"href":"https://api.github.com/repos/zetok/tox/issues/8"},"comments":{"href":"https://api.github.com/repos/zetok/tox/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/zetok/tox/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/zetok/tox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zetok/tox/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/zetok/tox/statuses/e2d63f7c8c3151a2efd05c4a740e90ec7b9cf7f3"}}}}
{"actor":{"display_login":"quininer"}}