{"action":"created","comment":{"url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/comments/216580009","pull_request_review_id":154089893,"id":216580009,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjU4MDAwOQ==","diff_hunk":"@@ -1,40 +1,62 @@\n package input\n \n-import \"net\"\n+import (\n+\t\"bytes\"\n+\t\"net\"\n+)\n \n-func listen(addr string, handler Handler) (net.Listener, error) {\n+func listen(addr string, handler Handler) error {\n \tladdr, err := net.ResolveTCPAddr(\"tcp\", addr)\n \tif err != nil {\n-\t\treturn nil, err\n+\t\treturn err\n \t}\n \tl, err := net.ListenTCP(\"tcp\", laddr)\n \tif err != nil {\n-\t\treturn nil, err\n+\t\treturn err\n \t}\n \tlog.Notice(\"listening on %v/tcp\", laddr)\n-\tgo accept(l, handler)\n+\tgo acceptTcp(l, handler)\n \n \tudp_addr, err := net.ResolveUDPAddr(\"udp\", addr)\n \tif err != nil {\n-\t\treturn nil, err\n+\t\treturn err\n \t}\n \tudp_conn, err := net.ListenUDP(\"udp\", udp_addr)\n \tif err != nil {\n-\t\treturn nil, err\n+\t\treturn err\n \t}\n \tlog.Notice(\"listening on %v/udp\", udp_addr)\n-\tgo handler.Handle(udp_conn)\n+\tgo acceptUdp(udp_conn, handler)\n \n-\treturn l, nil\n+\treturn nil\n }\n \n-func accept(l *net.TCPListener, handler Handler) {\n+func acceptTcp(l *net.TCPListener, handler Handler) {\n \tfor {\n \t\tc, err := l.AcceptTCP()\n \t\tif err != nil {\n \t\t\tlog.Error(err.Error())\n \t\t\tbreak\n \t\t}\n-\t\tgo handler.Handle(c)\n+\t\tgo acceptTcpConn(c, handler)\n+\t}\n+}\n+\n+func acceptTcpConn(c net.Conn, handler Handler) {\n+\tdefer c.Close()\n+\tlog.Debug(\"listen.go: tcp connection from %v\", c.RemoteAddr())\n+\thandler.Handle(c)\n+}\n+\n+func acceptUdp(l *net.UDPConn, handler Handler) {\n+\tbuffer := make([]byte, 65535)\n+\tfor {\n+\t\tb, addr, err := l.ReadFrom(buffer)\n+\t\tif err != nil {\n+\t\t\tlog.Error(err.Error())","path":"input/listen.go","position":67,"original_position":67,"commit_id":"6a5d52d11de45009d8d8125375eeb7b628ae9fda","original_commit_id":"6a5d52d11de45009d8d8125375eeb7b628ae9fda","user":{"login":"Dieterbe","id":20774,"node_id":"MDQ6VXNlcjIwNzc0","avatar_url":"https://avatars2.githubusercontent.com/u/20774?v=4","gravatar_id":"","url":"https://api.github.com/users/Dieterbe","html_url":"https://github.com/Dieterbe","followers_url":"https://api.github.com/users/Dieterbe/followers","following_url":"https://api.github.com/users/Dieterbe/following{/other_user}","gists_url":"https://api.github.com/users/Dieterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/Dieterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dieterbe/subscriptions","organizations_url":"https://api.github.com/users/Dieterbe/orgs","repos_url":"https://api.github.com/users/Dieterbe/repos","events_url":"https://api.github.com/users/Dieterbe/events{/privacy}","received_events_url":"https://api.github.com/users/Dieterbe/received_events","type":"User","site_admin":false},"body":"hmm so the moment we hit an error reading a single packet, we stop accepting any udp data. seems like we should handle this more gracefully?","created_at":"2018-09-11T08:08:47Z","updated_at":"2018-09-11T08:16:10Z","html_url":"https://github.com/graphite-ng/carbon-relay-ng/pull/286#discussion_r216580009","pull_request_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/comments/216580009"},"html":{"href":"https://github.com/graphite-ng/carbon-relay-ng/pull/286#discussion_r216580009"},"pull_request":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286"}}},"pull_request":{"url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286","id":197526102,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NTI2MTAy","html_url":"https://github.com/graphite-ng/carbon-relay-ng/pull/286","diff_url":"https://github.com/graphite-ng/carbon-relay-ng/pull/286.diff","patch_url":"https://github.com/graphite-ng/carbon-relay-ng/pull/286.patch","issue_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/286","number":286,"state":"open","locked":false,"title":"use bufio.Scanner to read plain input","user":{"login":"DanCech","id":1443603,"node_id":"MDQ6VXNlcjE0NDM2MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1443603?v=4","gravatar_id":"","url":"https://api.github.com/users/DanCech","html_url":"https://github.com/DanCech","followers_url":"https://api.github.com/users/DanCech/followers","following_url":"https://api.github.com/users/DanCech/following{/other_user}","gists_url":"https://api.github.com/users/DanCech/gists{/gist_id}","starred_url":"https://api.github.com/users/DanCech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanCech/subscriptions","organizations_url":"https://api.github.com/users/DanCech/orgs","repos_url":"https://api.github.com/users/DanCech/repos","events_url":"https://api.github.com/users/DanCech/events{/privacy}","received_events_url":"https://api.github.com/users/DanCech/received_events","type":"User","site_admin":false},"body":"For discussion, we can provide a buffer explicitly if we don't want to use the internal buffer.  Based on the Lines example in the docs https://golang.org/pkg/bufio/#Scanner","created_at":"2018-06-26T19:24:04Z","updated_at":"2018-09-11T08:16:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f3106493105518bd01283098a92052ba8f1630c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286/commits","review_comments_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286/comments","review_comment_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/comments{/number}","comments_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/286/comments","statuses_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/statuses/6a5d52d11de45009d8d8125375eeb7b628ae9fda","head":{"label":"DanCech:scanner","ref":"scanner","sha":"6a5d52d11de45009d8d8125375eeb7b628ae9fda","user":{"login":"DanCech","id":1443603,"node_id":"MDQ6VXNlcjE0NDM2MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1443603?v=4","gravatar_id":"","url":"https://api.github.com/users/DanCech","html_url":"https://github.com/DanCech","followers_url":"https://api.github.com/users/DanCech/followers","following_url":"https://api.github.com/users/DanCech/following{/other_user}","gists_url":"https://api.github.com/users/DanCech/gists{/gist_id}","starred_url":"https://api.github.com/users/DanCech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanCech/subscriptions","organizations_url":"https://api.github.com/users/DanCech/orgs","repos_url":"https://api.github.com/users/DanCech/repos","events_url":"https://api.github.com/users/DanCech/events{/privacy}","received_events_url":"https://api.github.com/users/DanCech/received_events","type":"User","site_admin":false},"repo":{"id":73944928,"node_id":"MDEwOlJlcG9zaXRvcnk3Mzk0NDkyOA==","name":"carbon-relay-ng","full_name":"DanCech/carbon-relay-ng","owner":{"login":"DanCech","id":1443603,"node_id":"MDQ6VXNlcjE0NDM2MDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1443603?v=4","gravatar_id":"","url":"https://api.github.com/users/DanCech","html_url":"https://github.com/DanCech","followers_url":"https://api.github.com/users/DanCech/followers","following_url":"https://api.github.com/users/DanCech/following{/other_user}","gists_url":"https://api.github.com/users/DanCech/gists{/gist_id}","starred_url":"https://api.github.com/users/DanCech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanCech/subscriptions","organizations_url":"https://api.github.com/users/DanCech/orgs","repos_url":"https://api.github.com/users/DanCech/repos","events_url":"https://api.github.com/users/DanCech/events{/privacy}","received_events_url":"https://api.github.com/users/DanCech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DanCech/carbon-relay-ng","description":"Fast carbon relay+aggregator with admin interfaces for making changes online - production ready","fork":true,"url":"https://api.github.com/repos/DanCech/carbon-relay-ng","forks_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/forks","keys_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/teams","hooks_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/hooks","issue_events_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/issues/events{/number}","events_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/events","assignees_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/assignees{/user}","branches_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/branches{/branch}","tags_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/tags","blobs_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/languages","stargazers_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/stargazers","contributors_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/contributors","subscribers_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/subscribers","subscription_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/subscription","commits_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/contents/{+path}","compare_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/merges","archive_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/downloads","issues_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/issues{/number}","pulls_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/labels{/name}","releases_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/releases{/id}","deployments_url":"https://api.github.com/repos/DanCech/carbon-relay-ng/deployments","created_at":"2016-11-16T17:38:58Z","updated_at":"2018-04-23T22:36:13Z","pushed_at":"2018-09-10T20:25:49Z","git_url":"git://github.com/DanCech/carbon-relay-ng.git","ssh_url":"git@github.com:DanCech/carbon-relay-ng.git","clone_url":"https://github.com/DanCech/carbon-relay-ng.git","svn_url":"https://github.com/DanCech/carbon-relay-ng","homepage":"","size":8174,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"graphite-ng:master","ref":"master","sha":"b64ef4d6dd7e2c4cc6428f34e5dbf40101397a0e","user":{"login":"graphite-ng","id":5354689,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzNTQ2ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5354689?v=4","gravatar_id":"","url":"https://api.github.com/users/graphite-ng","html_url":"https://github.com/graphite-ng","followers_url":"https://api.github.com/users/graphite-ng/followers","following_url":"https://api.github.com/users/graphite-ng/following{/other_user}","gists_url":"https://api.github.com/users/graphite-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/graphite-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphite-ng/subscriptions","organizations_url":"https://api.github.com/users/graphite-ng/orgs","repos_url":"https://api.github.com/users/graphite-ng/repos","events_url":"https://api.github.com/users/graphite-ng/events{/privacy}","received_events_url":"https://api.github.com/users/graphite-ng/received_events","type":"Organization","site_admin":false},"repo":{"id":4096203,"node_id":"MDEwOlJlcG9zaXRvcnk0MDk2MjAz","name":"carbon-relay-ng","full_name":"graphite-ng/carbon-relay-ng","owner":{"login":"graphite-ng","id":5354689,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzNTQ2ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5354689?v=4","gravatar_id":"","url":"https://api.github.com/users/graphite-ng","html_url":"https://github.com/graphite-ng","followers_url":"https://api.github.com/users/graphite-ng/followers","following_url":"https://api.github.com/users/graphite-ng/following{/other_user}","gists_url":"https://api.github.com/users/graphite-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/graphite-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphite-ng/subscriptions","organizations_url":"https://api.github.com/users/graphite-ng/orgs","repos_url":"https://api.github.com/users/graphite-ng/repos","events_url":"https://api.github.com/users/graphite-ng/events{/privacy}","received_events_url":"https://api.github.com/users/graphite-ng/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/graphite-ng/carbon-relay-ng","description":"Fast carbon relay+aggregator with admin interfaces for making changes online - production ready","fork":false,"url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng","forks_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/forks","keys_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/teams","hooks_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/hooks","issue_events_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/events{/number}","events_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/events","assignees_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/assignees{/user}","branches_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/branches{/branch}","tags_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/tags","blobs_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/languages","stargazers_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/stargazers","contributors_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/contributors","subscribers_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/subscribers","subscription_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/subscription","commits_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/contents/{+path}","compare_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/merges","archive_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/downloads","issues_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues{/number}","pulls_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/labels{/name}","releases_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/releases{/id}","deployments_url":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/deployments","created_at":"2012-04-21T13:13:54Z","updated_at":"2018-09-10T17:14:05Z","pushed_at":"2018-09-10T20:25:51Z","git_url":"git://github.com/graphite-ng/carbon-relay-ng.git","ssh_url":"git@github.com:graphite-ng/carbon-relay-ng.git","clone_url":"https://github.com/graphite-ng/carbon-relay-ng.git","svn_url":"https://github.com/graphite-ng/carbon-relay-ng","homepage":"","size":8177,"stargazers_count":348,"watchers_count":348,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":104,"open_issues":57,"watchers":348,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286"},"html":{"href":"https://github.com/graphite-ng/carbon-relay-ng/pull/286"},"issue":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/286"},"comments":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/issues/286/comments"},"review_comments":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286/comments"},"review_comment":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/pulls/286/commits"},"statuses":{"href":"https://api.github.com/repos/graphite-ng/carbon-relay-ng/statuses/6a5d52d11de45009d8d8125375eeb7b628ae9fda"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Dieterbe"}}