{"action":"created","comment":{"url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/comments/122678515","pull_request_review_id":44813956,"id":122678515,"diff_hunk":"@@ -432,68 +377,45 @@ static mrb_value mrb_networkanalyzer_current(mrb_state *mrb, mrb_value self)\n   return current;\n }\n \n-static mrb_value mrb_networkanalyzer_new(mrb_state *mrb, mrb_value self)\n+static mrb_value mrb_networkanalyzer_collect(mrb_state *mrb, mrb_value self)\n {\n   mrb_networkanalyzer_data *data;\n+  int dlt;\n+  int retry=0;\n   char *if_name;\n   int if_name_len;\n   char ebuf[PCAP_ERRBUF_SIZE];\n+  mrb_value sec, max;\n+  max = mrb_fixnum_value(-1);\n \n-  mrb_get_args(mrb, \"s\", &if_name, &if_name_len);\n+  mrb_get_args(mrb, \"si|i\", &if_name, &if_name_len, &sec, &max);","path":"src/mrb_networkanalyzer.c","position":137,"original_position":137,"commit_id":"07db2e999e74c9d19642aadf4a4424bc5d83f4ff","original_commit_id":"07db2e999e74c9d19642aadf4a4424bc5d83f4ff","user":{"login":"matsumotory","id":648437,"avatar_url":"https://avatars3.githubusercontent.com/u/648437?v=3","gravatar_id":"","url":"https://api.github.com/users/matsumotory","html_url":"https://github.com/matsumotory","followers_url":"https://api.github.com/users/matsumotory/followers","following_url":"https://api.github.com/users/matsumotory/following{/other_user}","gists_url":"https://api.github.com/users/matsumotory/gists{/gist_id}","starred_url":"https://api.github.com/users/matsumotory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matsumotory/subscriptions","organizations_url":"https://api.github.com/users/matsumotory/orgs","repos_url":"https://api.github.com/users/matsumotory/repos","events_url":"https://api.github.com/users/matsumotory/events{/privacy}","received_events_url":"https://api.github.com/users/matsumotory/received_events","type":"User","site_admin":false},"body":"もしif_name_lenが必要なく、if_nameにnull-teminatedな文字列を入れたい場合は、\"zi|i\"とすると良いと思います。後続の実装を見るに、if_nameはnull-terminated文字列で良さそうなので。","created_at":"2017-06-19T11:08:28Z","updated_at":"2017-06-19T11:08:28Z","html_url":"https://github.com/pyama86/mruby-network-analyzer/pull/6#discussion_r122678515","pull_request_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/comments/122678515"},"html":{"href":"https://github.com/pyama86/mruby-network-analyzer/pull/6#discussion_r122678515"},"pull_request":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6","id":126272388,"html_url":"https://github.com/pyama86/mruby-network-analyzer/pull/6","diff_url":"https://github.com/pyama86/mruby-network-analyzer/pull/6.diff","patch_url":"https://github.com/pyama86/mruby-network-analyzer/pull/6.patch","issue_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/6","number":6,"state":"open","locked":false,"title":"I will stop using threads","user":{"login":"pyama86","id":8022082,"avatar_url":"https://avatars3.githubusercontent.com/u/8022082?v=3","gravatar_id":"","url":"https://api.github.com/users/pyama86","html_url":"https://github.com/pyama86","followers_url":"https://api.github.com/users/pyama86/followers","following_url":"https://api.github.com/users/pyama86/following{/other_user}","gists_url":"https://api.github.com/users/pyama86/gists{/gist_id}","starred_url":"https://api.github.com/users/pyama86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyama86/subscriptions","organizations_url":"https://api.github.com/users/pyama86/orgs","repos_url":"https://api.github.com/users/pyama86/repos","events_url":"https://api.github.com/users/pyama86/events{/privacy}","received_events_url":"https://api.github.com/users/pyama86/received_events","type":"User","site_admin":false},"body":"スレッドを利用した場合に、リソースの開放処理での競合が発生しやすい状態となるため、ブロッキングにはなりますが、タイマーでのパケット収集へと変更します。\r\n\r\n```ruby\r\nNetworkAnalyzer.collect(\"lo\", 5)\r\n```\r\nのように設定した場合、`lo`のパケットを5秒間収集します。\r\n\r\n```ruby\r\nNetworkAnalyzer.collect(\"lo\", 5, 1000)\r\n```\r\n\r\nこのように第3引数を指定することで、パケットの最大処理数を指定することが出来るので、無限にループすることを避けられる実装になっています。","created_at":"2017-06-19T10:38:46Z","updated_at":"2017-06-19T11:08:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0a15043a8d7ba9ffcda3754495e647c6dca264d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6/commits","review_comments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6/comments","review_comment_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/6/comments","statuses_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/statuses/07db2e999e74c9d19642aadf4a4424bc5d83f4ff","head":{"label":"pyama86:drop-thread","ref":"drop-thread","sha":"07db2e999e74c9d19642aadf4a4424bc5d83f4ff","user":{"login":"pyama86","id":8022082,"avatar_url":"https://avatars3.githubusercontent.com/u/8022082?v=3","gravatar_id":"","url":"https://api.github.com/users/pyama86","html_url":"https://github.com/pyama86","followers_url":"https://api.github.com/users/pyama86/followers","following_url":"https://api.github.com/users/pyama86/following{/other_user}","gists_url":"https://api.github.com/users/pyama86/gists{/gist_id}","starred_url":"https://api.github.com/users/pyama86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyama86/subscriptions","organizations_url":"https://api.github.com/users/pyama86/orgs","repos_url":"https://api.github.com/users/pyama86/repos","events_url":"https://api.github.com/users/pyama86/events{/privacy}","received_events_url":"https://api.github.com/users/pyama86/received_events","type":"User","site_admin":false},"repo":{"id":94004780,"name":"mruby-network-analyzer","full_name":"pyama86/mruby-network-analyzer","owner":{"login":"pyama86","id":8022082,"avatar_url":"https://avatars3.githubusercontent.com/u/8022082?v=3","gravatar_id":"","url":"https://api.github.com/users/pyama86","html_url":"https://github.com/pyama86","followers_url":"https://api.github.com/users/pyama86/followers","following_url":"https://api.github.com/users/pyama86/following{/other_user}","gists_url":"https://api.github.com/users/pyama86/gists{/gist_id}","starred_url":"https://api.github.com/users/pyama86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyama86/subscriptions","organizations_url":"https://api.github.com/users/pyama86/orgs","repos_url":"https://api.github.com/users/pyama86/repos","events_url":"https://api.github.com/users/pyama86/events{/privacy}","received_events_url":"https://api.github.com/users/pyama86/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pyama86/mruby-network-analyzer","description":null,"fork":false,"url":"https://api.github.com/repos/pyama86/mruby-network-analyzer","forks_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/forks","keys_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/teams","hooks_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/hooks","issue_events_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/events","assignees_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/tags","blobs_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/languages","stargazers_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/stargazers","contributors_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/contributors","subscribers_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/subscribers","subscription_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/subscription","commits_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/merges","archive_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/downloads","issues_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/deployments","created_at":"2017-06-11T13:03:04Z","updated_at":"2017-06-11T13:11:43Z","pushed_at":"2017-06-19T10:38:47Z","git_url":"git://github.com/pyama86/mruby-network-analyzer.git","ssh_url":"git@github.com:pyama86/mruby-network-analyzer.git","clone_url":"https://github.com/pyama86/mruby-network-analyzer.git","svn_url":"https://github.com/pyama86/mruby-network-analyzer","homepage":null,"size":48,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":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"}},"base":{"label":"pyama86:master","ref":"master","sha":"0bb4bbb3c0f82e374580a222b20fe8b66e7b7c88","user":{"login":"pyama86","id":8022082,"avatar_url":"https://avatars3.githubusercontent.com/u/8022082?v=3","gravatar_id":"","url":"https://api.github.com/users/pyama86","html_url":"https://github.com/pyama86","followers_url":"https://api.github.com/users/pyama86/followers","following_url":"https://api.github.com/users/pyama86/following{/other_user}","gists_url":"https://api.github.com/users/pyama86/gists{/gist_id}","starred_url":"https://api.github.com/users/pyama86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyama86/subscriptions","organizations_url":"https://api.github.com/users/pyama86/orgs","repos_url":"https://api.github.com/users/pyama86/repos","events_url":"https://api.github.com/users/pyama86/events{/privacy}","received_events_url":"https://api.github.com/users/pyama86/received_events","type":"User","site_admin":false},"repo":{"id":94004780,"name":"mruby-network-analyzer","full_name":"pyama86/mruby-network-analyzer","owner":{"login":"pyama86","id":8022082,"avatar_url":"https://avatars3.githubusercontent.com/u/8022082?v=3","gravatar_id":"","url":"https://api.github.com/users/pyama86","html_url":"https://github.com/pyama86","followers_url":"https://api.github.com/users/pyama86/followers","following_url":"https://api.github.com/users/pyama86/following{/other_user}","gists_url":"https://api.github.com/users/pyama86/gists{/gist_id}","starred_url":"https://api.github.com/users/pyama86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyama86/subscriptions","organizations_url":"https://api.github.com/users/pyama86/orgs","repos_url":"https://api.github.com/users/pyama86/repos","events_url":"https://api.github.com/users/pyama86/events{/privacy}","received_events_url":"https://api.github.com/users/pyama86/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pyama86/mruby-network-analyzer","description":null,"fork":false,"url":"https://api.github.com/repos/pyama86/mruby-network-analyzer","forks_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/forks","keys_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/teams","hooks_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/hooks","issue_events_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/events","assignees_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/tags","blobs_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/languages","stargazers_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/stargazers","contributors_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/contributors","subscribers_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/subscribers","subscription_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/subscription","commits_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/merges","archive_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/downloads","issues_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/pyama86/mruby-network-analyzer/deployments","created_at":"2017-06-11T13:03:04Z","updated_at":"2017-06-11T13:11:43Z","pushed_at":"2017-06-19T10:38:47Z","git_url":"git://github.com/pyama86/mruby-network-analyzer.git","ssh_url":"git@github.com:pyama86/mruby-network-analyzer.git","clone_url":"https://github.com/pyama86/mruby-network-analyzer.git","svn_url":"https://github.com/pyama86/mruby-network-analyzer","homepage":null,"size":48,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":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/pyama86/mruby-network-analyzer/pulls/6"},"html":{"href":"https://github.com/pyama86/mruby-network-analyzer/pull/6"},"issue":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/6"},"comments":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/pyama86/mruby-network-analyzer/statuses/07db2e999e74c9d19642aadf4a4424bc5d83f4ff"}}}}
{"actor":{"display_login":"matsumotory"}}