{"action":"created","comment":{"url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/comments/67608556","id":67608556,"diff_hunk":"@@ -73,39 +96,35 @@ fn print_usage(program: &str, opts: Options) {\n     print!(\"{}\", opts.usage(&brief));\n }\n \n-fn run_client(host: &str, port: u16, time: u64) -> Result<(), ::std::io::Error> {\n-    let mut c = try!(client::TestClient::new(host, port));\n+fn run_client(host: &str, port: u16, time: u64, pings: u64) -> Result<(), ::std::io::Error> {\n+    let mut c = try!(test_client::TestClient::new(host, port));\n \n-    print!(\"Testing ping... \");\n+    info!(\"Testing ping... ({} times) \", pings);\n     try!(stdout().flush());\n-    println!(\"done, {:.*} ms\", 2, try!(c.test_ping(20)));\n+    let ping_time = try!(c.test_ping(pings));\n+    info!(\"done, {:.*} ms\", 2, ping_time);\n \n-    print!(\"Testing download... \");\n+    info!(\"Testing download... ({} seconds) \", time);\n     try!(stdout().flush());\n-    println!(\"done, {}\", format_speed(try!(c.test_downstream(time * 1_000u64))));\n+    let download_speed = try!(c.test_downstream(time * 1_000u64));\n+    info!(\"done, {}\", format_speed(download_speed));\n \n-    print!(\"Testing upload... \");\n+    info!(\"Testing upload... ({} seconds) \", time);\n     try!(stdout().flush());\n-    println!(\"done, {}\", format_speed(try!(c.test_upstream(time * 1_000u64))));\n+    let upload_speed = try!(c.test_upstream(time * 1_000u64));\n+    info!(\"done, {}\", format_speed(upload_speed));\n \n     Ok(())\n }\n \n-fn launch_server(port: u16, listen: &str) {\n-    println!(\"Listening...\");\n-    let s = server::TestServer::new(port, listen);\n-    s.listen();\n-}\n-\n fn format_speed(speed: f64) -> String {\n     let mut speed = speed;\n-    let units = [\"bit/s\", \"kbit/s\", \"Mbit/s\", \"Gbit/s\", \"Tbit/s?!\"];\n+    let units = [\"bit/s\", \"Kbit/s\", \"Mbit/s\", \"Gbit/s\", \"Tbit/s\"];","path":"src/main.rs","position":139,"original_position":139,"commit_id":"787f3ac4fc5e00b5397fe845f04c59d787838484","original_commit_id":"787f3ac4fc5e00b5397fe845f04c59d787838484","user":{"login":"Kilobyte22","id":2998042,"avatar_url":"https://avatars.githubusercontent.com/u/2998042?v=3","gravatar_id":"","url":"https://api.github.com/users/Kilobyte22","html_url":"https://github.com/Kilobyte22","followers_url":"https://api.github.com/users/Kilobyte22/followers","following_url":"https://api.github.com/users/Kilobyte22/following{/other_user}","gists_url":"https://api.github.com/users/Kilobyte22/gists{/gist_id}","starred_url":"https://api.github.com/users/Kilobyte22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kilobyte22/subscriptions","organizations_url":"https://api.github.com/users/Kilobyte22/orgs","repos_url":"https://api.github.com/users/Kilobyte22/repos","events_url":"https://api.github.com/users/Kilobyte22/events{/privacy}","received_events_url":"https://api.github.com/users/Kilobyte22/received_events","type":"User","site_admin":false},"body":"I actually checked and it's kbit. Also refer to https://en.wikipedia.org/wiki/Data_rate_units","created_at":"2016-06-19T00:33:49Z","updated_at":"2016-06-19T00:33:49Z","html_url":"https://github.com/Kilobyte22/nettest/pull/1#discussion_r67608556","pull_request_url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/comments/67608556"},"html":{"href":"https://github.com/Kilobyte22/nettest/pull/1#discussion_r67608556"},"pull_request":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1","id":74336933,"html_url":"https://github.com/Kilobyte22/nettest/pull/1","diff_url":"https://github.com/Kilobyte22/nettest/pull/1.diff","patch_url":"https://github.com/Kilobyte22/nettest/pull/1.patch","issue_url":"https://api.github.com/repos/Kilobyte22/nettest/issues/1","number":1,"state":"open","locked":false,"title":"Some code cleanup and a pings option.","user":{"login":"andrewdavidmackenzie","id":5529132,"avatar_url":"https://avatars.githubusercontent.com/u/5529132?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewdavidmackenzie","html_url":"https://github.com/andrewdavidmackenzie","followers_url":"https://api.github.com/users/andrewdavidmackenzie/followers","following_url":"https://api.github.com/users/andrewdavidmackenzie/following{/other_user}","gists_url":"https://api.github.com/users/andrewdavidmackenzie/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewdavidmackenzie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewdavidmackenzie/subscriptions","organizations_url":"https://api.github.com/users/andrewdavidmackenzie/orgs","repos_url":"https://api.github.com/users/andrewdavidmackenzie/repos","events_url":"https://api.github.com/users/andrewdavidmackenzie/events{/privacy}","received_events_url":"https://api.github.com/users/andrewdavidmackenzie/received_events","type":"User","site_admin":false},"body":"Use of constants. Print out more info using the actual value set not hardcoded in strings.\nAdded option to specify number of pings to perform.\nPrint out the version number of the program at start.\nStore results in variables ready to print/send a summary.\nRemoved commented code.\nMoved some of the string output relevant to Server into server class.\nAdded a TOTO.md file to keep track of ideas and things to improve.\nBumped the version number for my fork.","created_at":"2016-06-18T13:19:58Z","updated_at":"2016-06-19T00:33:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a53024e362fac0073d9922dff2949929845586ac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Kilobyte22/nettest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kilobyte22/nettest/issues/1/comments","statuses_url":"https://api.github.com/repos/Kilobyte22/nettest/statuses/787f3ac4fc5e00b5397fe845f04c59d787838484","head":{"label":"andrewdavidmackenzie:master","ref":"master","sha":"787f3ac4fc5e00b5397fe845f04c59d787838484","user":{"login":"andrewdavidmackenzie","id":5529132,"avatar_url":"https://avatars.githubusercontent.com/u/5529132?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewdavidmackenzie","html_url":"https://github.com/andrewdavidmackenzie","followers_url":"https://api.github.com/users/andrewdavidmackenzie/followers","following_url":"https://api.github.com/users/andrewdavidmackenzie/following{/other_user}","gists_url":"https://api.github.com/users/andrewdavidmackenzie/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewdavidmackenzie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewdavidmackenzie/subscriptions","organizations_url":"https://api.github.com/users/andrewdavidmackenzie/orgs","repos_url":"https://api.github.com/users/andrewdavidmackenzie/repos","events_url":"https://api.github.com/users/andrewdavidmackenzie/events{/privacy}","received_events_url":"https://api.github.com/users/andrewdavidmackenzie/received_events","type":"User","site_admin":false},"repo":{"id":61431740,"name":"nettest","full_name":"andrewdavidmackenzie/nettest","owner":{"login":"andrewdavidmackenzie","id":5529132,"avatar_url":"https://avatars.githubusercontent.com/u/5529132?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewdavidmackenzie","html_url":"https://github.com/andrewdavidmackenzie","followers_url":"https://api.github.com/users/andrewdavidmackenzie/followers","following_url":"https://api.github.com/users/andrewdavidmackenzie/following{/other_user}","gists_url":"https://api.github.com/users/andrewdavidmackenzie/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewdavidmackenzie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewdavidmackenzie/subscriptions","organizations_url":"https://api.github.com/users/andrewdavidmackenzie/orgs","repos_url":"https://api.github.com/users/andrewdavidmackenzie/repos","events_url":"https://api.github.com/users/andrewdavidmackenzie/events{/privacy}","received_events_url":"https://api.github.com/users/andrewdavidmackenzie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrewdavidmackenzie/nettest","description":"A simple speedtest with self-hosted server","fork":true,"url":"https://api.github.com/repos/andrewdavidmackenzie/nettest","forks_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/forks","keys_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/teams","hooks_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/hooks","issue_events_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/issues/events{/number}","events_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/events","assignees_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/assignees{/user}","branches_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/branches{/branch}","tags_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/tags","blobs_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/languages","stargazers_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/stargazers","contributors_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/contributors","subscribers_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/subscribers","subscription_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/subscription","commits_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/contents/{+path}","compare_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/merges","archive_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/downloads","issues_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/issues{/number}","pulls_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/labels{/name}","releases_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/releases{/id}","deployments_url":"https://api.github.com/repos/andrewdavidmackenzie/nettest/deployments","created_at":"2016-06-18T12:06:14Z","updated_at":"2016-06-18T12:06:15Z","pushed_at":"2016-06-18T19:14:55Z","git_url":"git://github.com/andrewdavidmackenzie/nettest.git","ssh_url":"git@github.com:andrewdavidmackenzie/nettest.git","clone_url":"https://github.com/andrewdavidmackenzie/nettest.git","svn_url":"https://github.com/andrewdavidmackenzie/nettest","homepage":null,"size":20,"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":"Kilobyte22:master","ref":"master","sha":"60e26a7daf455f54b083a79a83b138797059a149","user":{"login":"Kilobyte22","id":2998042,"avatar_url":"https://avatars.githubusercontent.com/u/2998042?v=3","gravatar_id":"","url":"https://api.github.com/users/Kilobyte22","html_url":"https://github.com/Kilobyte22","followers_url":"https://api.github.com/users/Kilobyte22/followers","following_url":"https://api.github.com/users/Kilobyte22/following{/other_user}","gists_url":"https://api.github.com/users/Kilobyte22/gists{/gist_id}","starred_url":"https://api.github.com/users/Kilobyte22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kilobyte22/subscriptions","organizations_url":"https://api.github.com/users/Kilobyte22/orgs","repos_url":"https://api.github.com/users/Kilobyte22/repos","events_url":"https://api.github.com/users/Kilobyte22/events{/privacy}","received_events_url":"https://api.github.com/users/Kilobyte22/received_events","type":"User","site_admin":false},"repo":{"id":46819070,"name":"nettest","full_name":"Kilobyte22/nettest","owner":{"login":"Kilobyte22","id":2998042,"avatar_url":"https://avatars.githubusercontent.com/u/2998042?v=3","gravatar_id":"","url":"https://api.github.com/users/Kilobyte22","html_url":"https://github.com/Kilobyte22","followers_url":"https://api.github.com/users/Kilobyte22/followers","following_url":"https://api.github.com/users/Kilobyte22/following{/other_user}","gists_url":"https://api.github.com/users/Kilobyte22/gists{/gist_id}","starred_url":"https://api.github.com/users/Kilobyte22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kilobyte22/subscriptions","organizations_url":"https://api.github.com/users/Kilobyte22/orgs","repos_url":"https://api.github.com/users/Kilobyte22/repos","events_url":"https://api.github.com/users/Kilobyte22/events{/privacy}","received_events_url":"https://api.github.com/users/Kilobyte22/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kilobyte22/nettest","description":"A simple speedtest with self-hosted server","fork":false,"url":"https://api.github.com/repos/Kilobyte22/nettest","forks_url":"https://api.github.com/repos/Kilobyte22/nettest/forks","keys_url":"https://api.github.com/repos/Kilobyte22/nettest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kilobyte22/nettest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kilobyte22/nettest/teams","hooks_url":"https://api.github.com/repos/Kilobyte22/nettest/hooks","issue_events_url":"https://api.github.com/repos/Kilobyte22/nettest/issues/events{/number}","events_url":"https://api.github.com/repos/Kilobyte22/nettest/events","assignees_url":"https://api.github.com/repos/Kilobyte22/nettest/assignees{/user}","branches_url":"https://api.github.com/repos/Kilobyte22/nettest/branches{/branch}","tags_url":"https://api.github.com/repos/Kilobyte22/nettest/tags","blobs_url":"https://api.github.com/repos/Kilobyte22/nettest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kilobyte22/nettest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kilobyte22/nettest/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kilobyte22/nettest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kilobyte22/nettest/statuses/{sha}","languages_url":"https://api.github.com/repos/Kilobyte22/nettest/languages","stargazers_url":"https://api.github.com/repos/Kilobyte22/nettest/stargazers","contributors_url":"https://api.github.com/repos/Kilobyte22/nettest/contributors","subscribers_url":"https://api.github.com/repos/Kilobyte22/nettest/subscribers","subscription_url":"https://api.github.com/repos/Kilobyte22/nettest/subscription","commits_url":"https://api.github.com/repos/Kilobyte22/nettest/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kilobyte22/nettest/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kilobyte22/nettest/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kilobyte22/nettest/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kilobyte22/nettest/contents/{+path}","compare_url":"https://api.github.com/repos/Kilobyte22/nettest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kilobyte22/nettest/merges","archive_url":"https://api.github.com/repos/Kilobyte22/nettest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kilobyte22/nettest/downloads","issues_url":"https://api.github.com/repos/Kilobyte22/nettest/issues{/number}","pulls_url":"https://api.github.com/repos/Kilobyte22/nettest/pulls{/number}","milestones_url":"https://api.github.com/repos/Kilobyte22/nettest/milestones{/number}","notifications_url":"https://api.github.com/repos/Kilobyte22/nettest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kilobyte22/nettest/labels{/name}","releases_url":"https://api.github.com/repos/Kilobyte22/nettest/releases{/id}","deployments_url":"https://api.github.com/repos/Kilobyte22/nettest/deployments","created_at":"2015-11-24T21:16:03Z","updated_at":"2016-02-18T14:07:23Z","pushed_at":"2016-06-18T19:14:56Z","git_url":"git://github.com/Kilobyte22/nettest.git","ssh_url":"git@github.com:Kilobyte22/nettest.git","clone_url":"https://github.com/Kilobyte22/nettest.git","svn_url":"https://github.com/Kilobyte22/nettest","homepage":null,"size":10,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1"},"html":{"href":"https://github.com/Kilobyte22/nettest/pull/1"},"issue":{"href":"https://api.github.com/repos/Kilobyte22/nettest/issues/1"},"comments":{"href":"https://api.github.com/repos/Kilobyte22/nettest/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kilobyte22/nettest/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Kilobyte22/nettest/statuses/787f3ac4fc5e00b5397fe845f04c59d787838484"}}}}
{"actor":{"display_login":"Kilobyte22"}}