{"action":"created","comment":{"url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/comments/102063132","pull_request_review_id":22807547,"id":102063132,"diff_hunk":"@@ -920,15 +920,23 @@ unsigned int g_num_worker_threads = WFORCE_NUM_WORKER_THREADS;\n void pollThread()\n {\n   ctpl::thread_pool p(g_num_worker_threads, 5000);\n+  const int fd_increase = 50; // somewhat arbitrary\n+  struct pollfd* fds=NULL;\n+  int max_fd_size = -1;\n \n   for (;;) {\n     // parse the array of sockets and create a pollfd array\n-    struct pollfd* fds;\n     int num_fds=0;\n     {\n       std::lock_guard<std::mutex> lock(sock_vec_mutx);\n       num_fds = sock_vec.size();\n-      fds = new struct pollfd [num_fds];\n+      // Only allocate a new pollfd array if it needs to be bigger\n+      if (num_fds > max_fd_size) {\n+\tif (fds)","path":"wforce-web.cc","position":97,"original_position":18,"commit_id":"28b2cb22327192177de9a7024565bb9d19f0d567","original_commit_id":"86afe69f9b2ce70b7b61619570af4ede40e2c0b5","user":{"login":"cmouse","id":1204643,"avatar_url":"https://avatars.githubusercontent.com/u/1204643?v=3","gravatar_id":"","url":"https://api.github.com/users/cmouse","html_url":"https://github.com/cmouse","followers_url":"https://api.github.com/users/cmouse/followers","following_url":"https://api.github.com/users/cmouse/following{/other_user}","gists_url":"https://api.github.com/users/cmouse/gists{/gist_id}","starred_url":"https://api.github.com/users/cmouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmouse/subscriptions","organizations_url":"https://api.github.com/users/cmouse/orgs","repos_url":"https://api.github.com/users/cmouse/repos","events_url":"https://api.github.com/users/cmouse/events{/privacy}","received_events_url":"https://api.github.com/users/cmouse/received_events","type":"User","site_admin":false},"body":"use fds != NULL","created_at":"2017-02-20T17:20:11Z","updated_at":"2017-02-20T17:20:25Z","html_url":"https://github.com/PowerDNS/weakforced/pull/112#discussion_r102063132","pull_request_url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112","_links":{"self":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/comments/102063132"},"html":{"href":"https://github.com/PowerDNS/weakforced/pull/112#discussion_r102063132"},"pull_request":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112"}}},"pull_request":{"url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112","id":107037250,"html_url":"https://github.com/PowerDNS/weakforced/pull/112","diff_url":"https://github.com/PowerDNS/weakforced/pull/112.diff","patch_url":"https://github.com/PowerDNS/weakforced/pull/112.patch","issue_url":"https://api.github.com/repos/PowerDNS/weakforced/issues/112","number":112,"state":"open","locked":false,"title":"Support for device parsing","user":{"login":"neilcook","id":15052760,"avatar_url":"https://avatars.githubusercontent.com/u/15052760?v=3","gravatar_id":"","url":"https://api.github.com/users/neilcook","html_url":"https://github.com/neilcook","followers_url":"https://api.github.com/users/neilcook/followers","following_url":"https://api.github.com/users/neilcook/following{/other_user}","gists_url":"https://api.github.com/users/neilcook/gists{/gist_id}","starred_url":"https://api.github.com/users/neilcook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilcook/subscriptions","organizations_url":"https://api.github.com/users/neilcook/orgs","repos_url":"https://api.github.com/users/neilcook/repos","events_url":"https://api.github.com/users/neilcook/events{/privacy}","received_events_url":"https://api.github.com/users/neilcook/received_events","type":"User","site_admin":false},"body":"This PR adds support for parsing of device_id fields.\r\n\r\nIf \"device_id\" field is present in allow or report command, but no \"device_attrs\" field then device_attrs will be populated. The device_id field is parsed according to the \"protocol\" field, i.e. if http(s) then it is parsed as if it were a User-Agent string from HTTP headers, if imap(s) then it is parsed as if it were an IMAP ClientID string. Other protocols will not be parsed, as they have no string representing the device (e.g. pop, smtp).\r\n\r\nHTTP User-Agent parsing is done with the uap-cpp library, which is copied from https://github.com/ua-parser/uap-cpp\r\nIMAP ClientID parsing is done with hardcoded regexes for now.\r\n\r\nNew -R option to wforce is added to specify where to find the regexes needed by uap-cpp. These are retrieved from https://github.com/ua-parser/uap-core/blob/master/regexes.yaml at build time if they don't exist locally, so they will always reflect the latest version.\r\n\r\nThis PR also includes a small performance optimisation to wforce-web.cc, when is to not reallocate the pollfd array every loop, but to reallocate only if it needs to grow.","created_at":"2017-02-20T16:18:10Z","updated_at":"2017-02-20T17:20:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec51919f67d3db435ff5df4b3fd4034696bd0188","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112/commits","review_comments_url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112/comments","review_comment_url":"https://api.github.com/repos/PowerDNS/weakforced/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PowerDNS/weakforced/issues/112/comments","statuses_url":"https://api.github.com/repos/PowerDNS/weakforced/statuses/28b2cb22327192177de9a7024565bb9d19f0d567","head":{"label":"neilcook:device_parsing","ref":"device_parsing","sha":"28b2cb22327192177de9a7024565bb9d19f0d567","user":{"login":"neilcook","id":15052760,"avatar_url":"https://avatars.githubusercontent.com/u/15052760?v=3","gravatar_id":"","url":"https://api.github.com/users/neilcook","html_url":"https://github.com/neilcook","followers_url":"https://api.github.com/users/neilcook/followers","following_url":"https://api.github.com/users/neilcook/following{/other_user}","gists_url":"https://api.github.com/users/neilcook/gists{/gist_id}","starred_url":"https://api.github.com/users/neilcook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilcook/subscriptions","organizations_url":"https://api.github.com/users/neilcook/orgs","repos_url":"https://api.github.com/users/neilcook/repos","events_url":"https://api.github.com/users/neilcook/events{/privacy}","received_events_url":"https://api.github.com/users/neilcook/received_events","type":"User","site_admin":false},"repo":{"id":44251668,"name":"weakforced","full_name":"neilcook/weakforced","owner":{"login":"neilcook","id":15052760,"avatar_url":"https://avatars.githubusercontent.com/u/15052760?v=3","gravatar_id":"","url":"https://api.github.com/users/neilcook","html_url":"https://github.com/neilcook","followers_url":"https://api.github.com/users/neilcook/followers","following_url":"https://api.github.com/users/neilcook/following{/other_user}","gists_url":"https://api.github.com/users/neilcook/gists{/gist_id}","starred_url":"https://api.github.com/users/neilcook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilcook/subscriptions","organizations_url":"https://api.github.com/users/neilcook/orgs","repos_url":"https://api.github.com/users/neilcook/repos","events_url":"https://api.github.com/users/neilcook/events{/privacy}","received_events_url":"https://api.github.com/users/neilcook/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neilcook/weakforced","description":null,"fork":true,"url":"https://api.github.com/repos/neilcook/weakforced","forks_url":"https://api.github.com/repos/neilcook/weakforced/forks","keys_url":"https://api.github.com/repos/neilcook/weakforced/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neilcook/weakforced/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neilcook/weakforced/teams","hooks_url":"https://api.github.com/repos/neilcook/weakforced/hooks","issue_events_url":"https://api.github.com/repos/neilcook/weakforced/issues/events{/number}","events_url":"https://api.github.com/repos/neilcook/weakforced/events","assignees_url":"https://api.github.com/repos/neilcook/weakforced/assignees{/user}","branches_url":"https://api.github.com/repos/neilcook/weakforced/branches{/branch}","tags_url":"https://api.github.com/repos/neilcook/weakforced/tags","blobs_url":"https://api.github.com/repos/neilcook/weakforced/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neilcook/weakforced/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neilcook/weakforced/git/refs{/sha}","trees_url":"https://api.github.com/repos/neilcook/weakforced/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neilcook/weakforced/statuses/{sha}","languages_url":"https://api.github.com/repos/neilcook/weakforced/languages","stargazers_url":"https://api.github.com/repos/neilcook/weakforced/stargazers","contributors_url":"https://api.github.com/repos/neilcook/weakforced/contributors","subscribers_url":"https://api.github.com/repos/neilcook/weakforced/subscribers","subscription_url":"https://api.github.com/repos/neilcook/weakforced/subscription","commits_url":"https://api.github.com/repos/neilcook/weakforced/commits{/sha}","git_commits_url":"https://api.github.com/repos/neilcook/weakforced/git/commits{/sha}","comments_url":"https://api.github.com/repos/neilcook/weakforced/comments{/number}","issue_comment_url":"https://api.github.com/repos/neilcook/weakforced/issues/comments{/number}","contents_url":"https://api.github.com/repos/neilcook/weakforced/contents/{+path}","compare_url":"https://api.github.com/repos/neilcook/weakforced/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neilcook/weakforced/merges","archive_url":"https://api.github.com/repos/neilcook/weakforced/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neilcook/weakforced/downloads","issues_url":"https://api.github.com/repos/neilcook/weakforced/issues{/number}","pulls_url":"https://api.github.com/repos/neilcook/weakforced/pulls{/number}","milestones_url":"https://api.github.com/repos/neilcook/weakforced/milestones{/number}","notifications_url":"https://api.github.com/repos/neilcook/weakforced/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neilcook/weakforced/labels{/name}","releases_url":"https://api.github.com/repos/neilcook/weakforced/releases{/id}","deployments_url":"https://api.github.com/repos/neilcook/weakforced/deployments","created_at":"2015-10-14T14:06:55Z","updated_at":"2016-10-27T09:08:10Z","pushed_at":"2017-02-20T16:07:22Z","git_url":"git://github.com/neilcook/weakforced.git","ssh_url":"git@github.com:neilcook/weakforced.git","clone_url":"https://github.com/neilcook/weakforced.git","svn_url":"https://github.com/neilcook/weakforced","homepage":null,"size":953,"stargazers_count":2,"watchers_count":2,"language":"C++","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":2,"default_branch":"master"}},"base":{"label":"PowerDNS:master","ref":"master","sha":"983582a936d3d2d6448ac9ce10b91d4f9e774589","user":{"login":"PowerDNS","id":1282630,"avatar_url":"https://avatars.githubusercontent.com/u/1282630?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerDNS","html_url":"https://github.com/PowerDNS","followers_url":"https://api.github.com/users/PowerDNS/followers","following_url":"https://api.github.com/users/PowerDNS/following{/other_user}","gists_url":"https://api.github.com/users/PowerDNS/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerDNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerDNS/subscriptions","organizations_url":"https://api.github.com/users/PowerDNS/orgs","repos_url":"https://api.github.com/users/PowerDNS/repos","events_url":"https://api.github.com/users/PowerDNS/events{/privacy}","received_events_url":"https://api.github.com/users/PowerDNS/received_events","type":"Organization","site_admin":false},"repo":{"id":33265470,"name":"weakforced","full_name":"PowerDNS/weakforced","owner":{"login":"PowerDNS","id":1282630,"avatar_url":"https://avatars.githubusercontent.com/u/1282630?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerDNS","html_url":"https://github.com/PowerDNS","followers_url":"https://api.github.com/users/PowerDNS/followers","following_url":"https://api.github.com/users/PowerDNS/following{/other_user}","gists_url":"https://api.github.com/users/PowerDNS/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerDNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerDNS/subscriptions","organizations_url":"https://api.github.com/users/PowerDNS/orgs","repos_url":"https://api.github.com/users/PowerDNS/repos","events_url":"https://api.github.com/users/PowerDNS/events{/privacy}","received_events_url":"https://api.github.com/users/PowerDNS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PowerDNS/weakforced","description":"Anti-Abuse for servers at authentication time","fork":false,"url":"https://api.github.com/repos/PowerDNS/weakforced","forks_url":"https://api.github.com/repos/PowerDNS/weakforced/forks","keys_url":"https://api.github.com/repos/PowerDNS/weakforced/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PowerDNS/weakforced/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PowerDNS/weakforced/teams","hooks_url":"https://api.github.com/repos/PowerDNS/weakforced/hooks","issue_events_url":"https://api.github.com/repos/PowerDNS/weakforced/issues/events{/number}","events_url":"https://api.github.com/repos/PowerDNS/weakforced/events","assignees_url":"https://api.github.com/repos/PowerDNS/weakforced/assignees{/user}","branches_url":"https://api.github.com/repos/PowerDNS/weakforced/branches{/branch}","tags_url":"https://api.github.com/repos/PowerDNS/weakforced/tags","blobs_url":"https://api.github.com/repos/PowerDNS/weakforced/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PowerDNS/weakforced/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PowerDNS/weakforced/git/refs{/sha}","trees_url":"https://api.github.com/repos/PowerDNS/weakforced/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PowerDNS/weakforced/statuses/{sha}","languages_url":"https://api.github.com/repos/PowerDNS/weakforced/languages","stargazers_url":"https://api.github.com/repos/PowerDNS/weakforced/stargazers","contributors_url":"https://api.github.com/repos/PowerDNS/weakforced/contributors","subscribers_url":"https://api.github.com/repos/PowerDNS/weakforced/subscribers","subscription_url":"https://api.github.com/repos/PowerDNS/weakforced/subscription","commits_url":"https://api.github.com/repos/PowerDNS/weakforced/commits{/sha}","git_commits_url":"https://api.github.com/repos/PowerDNS/weakforced/git/commits{/sha}","comments_url":"https://api.github.com/repos/PowerDNS/weakforced/comments{/number}","issue_comment_url":"https://api.github.com/repos/PowerDNS/weakforced/issues/comments{/number}","contents_url":"https://api.github.com/repos/PowerDNS/weakforced/contents/{+path}","compare_url":"https://api.github.com/repos/PowerDNS/weakforced/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PowerDNS/weakforced/merges","archive_url":"https://api.github.com/repos/PowerDNS/weakforced/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PowerDNS/weakforced/downloads","issues_url":"https://api.github.com/repos/PowerDNS/weakforced/issues{/number}","pulls_url":"https://api.github.com/repos/PowerDNS/weakforced/pulls{/number}","milestones_url":"https://api.github.com/repos/PowerDNS/weakforced/milestones{/number}","notifications_url":"https://api.github.com/repos/PowerDNS/weakforced/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PowerDNS/weakforced/labels{/name}","releases_url":"https://api.github.com/repos/PowerDNS/weakforced/releases{/id}","deployments_url":"https://api.github.com/repos/PowerDNS/weakforced/deployments","created_at":"2015-04-01T18:37:52Z","updated_at":"2017-02-13T08:48:52Z","pushed_at":"2017-02-20T16:18:11Z","git_url":"git://github.com/PowerDNS/weakforced.git","ssh_url":"git@github.com:PowerDNS/weakforced.git","clone_url":"https://github.com/PowerDNS/weakforced.git","svn_url":"https://github.com/PowerDNS/weakforced","homepage":"","size":942,"stargazers_count":33,"watchers_count":33,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":5,"forks":11,"open_issues":5,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112"},"html":{"href":"https://github.com/PowerDNS/weakforced/pull/112"},"issue":{"href":"https://api.github.com/repos/PowerDNS/weakforced/issues/112"},"comments":{"href":"https://api.github.com/repos/PowerDNS/weakforced/issues/112/comments"},"review_comments":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112/comments"},"review_comment":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PowerDNS/weakforced/pulls/112/commits"},"statuses":{"href":"https://api.github.com/repos/PowerDNS/weakforced/statuses/28b2cb22327192177de9a7024565bb9d19f0d567"}}}}
{"actor":{"display_login":"cmouse"}}