{"action":"created","comment":{"url":"https://api.github.com/repos/onitake/daliserver/pulls/comments/228891339","pull_request_review_id":169258072,"id":228891339,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODg5MTMzOQ==","diff_hunk":"@@ -74,35 +74,40 @@ ServerPtr server_open(DispatchPtr dispatch, const char *listenaddr, unsigned int\n \t\tlog_debug(\"Opening connection on %s:%u\", listenaddr, port);\n \t\tserver->listener = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);\n \t\tif (server->listener != -1) {\n-\t\t\tstruct sockaddr_in all_if;\n-\t\t\tmemset(&all_if, 0, sizeof(all_if));\n-\t\t\tall_if.sin_family = AF_INET;\n-\t\t\tall_if.sin_port = htons((uint16_t) port);\n-\t\t\tif (inet_pton(AF_INET, listenaddr, &all_if.sin_addr) == 1) {\n-\t\t\t\tif (bind(server->listener, (struct sockaddr *) &all_if, sizeof(all_if)) == 0) {\n-\t\t\t\t\tif (listen(server->listener, MAX_CONNECTIONS) == 0) {\n-\t\t\t\t\t\tserver->dispatch = dispatch;\n-\t\t\t\t\t\tif (dispatch) {\n-\t\t\t\t\t\t\tlog_debug(\"Registering server socket %d\", server->listener);\n-\t\t\t\t\t\t\tdispatch_add(dispatch, server->listener, POLLIN, server_listener_ready, server_listener_error, NULL, server);\n+\t\t\tif (setsockopt(server->listener, SOL_SOCKET, SO_REUSEADDR, & (int) {1}, sizeof(int)) == 0) {","path":"lib/net.c","position":null,"original_position":15,"commit_id":"0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7","original_commit_id":"bff5c6c52c017d8b4d587fefd425119683a02648","user":{"login":"s3lph","id":5564491,"node_id":"MDQ6VXNlcjU1NjQ0OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/5564491?v=4","gravatar_id":"","url":"https://api.github.com/users/s3lph","html_url":"https://github.com/s3lph","followers_url":"https://api.github.com/users/s3lph/followers","following_url":"https://api.github.com/users/s3lph/following{/other_user}","gists_url":"https://api.github.com/users/s3lph/gists{/gist_id}","starred_url":"https://api.github.com/users/s3lph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s3lph/subscriptions","organizations_url":"https://api.github.com/users/s3lph/orgs","repos_url":"https://api.github.com/users/s3lph/repos","events_url":"https://api.github.com/users/s3lph/events{/privacy}","received_events_url":"https://api.github.com/users/s3lph/received_events","type":"User","site_admin":false},"body":"I've had a look at this again. This is not a type confusion. The initializer `(int) {1}` does not create an int array, but a single int, whose reference is then passed to setsockopt. So it isn't wrong, just ugly :)","created_at":"2018-10-29T11:41:06Z","updated_at":"2018-10-29T11:41:06Z","html_url":"https://github.com/onitake/daliserver/pull/20#discussion_r228891339","pull_request_url":"https://api.github.com/repos/onitake/daliserver/pulls/20","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/comments/228891339"},"html":{"href":"https://github.com/onitake/daliserver/pull/20#discussion_r228891339"},"pull_request":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/20"}},"in_reply_to_id":227657836},"pull_request":{"url":"https://api.github.com/repos/onitake/daliserver/pulls/20","id":206806532,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2ODA2NTMy","html_url":"https://github.com/onitake/daliserver/pull/20","diff_url":"https://github.com/onitake/daliserver/pull/20.diff","patch_url":"https://github.com/onitake/daliserver/pull/20.patch","issue_url":"https://api.github.com/repos/onitake/daliserver/issues/20","number":20,"state":"open","locked":false,"title":"Set SO_REUSEADDR when starting the server.","user":{"login":"s3lph","id":5564491,"node_id":"MDQ6VXNlcjU1NjQ0OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/5564491?v=4","gravatar_id":"","url":"https://api.github.com/users/s3lph","html_url":"https://github.com/s3lph","followers_url":"https://api.github.com/users/s3lph/followers","following_url":"https://api.github.com/users/s3lph/following{/other_user}","gists_url":"https://api.github.com/users/s3lph/gists{/gist_id}","starred_url":"https://api.github.com/users/s3lph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s3lph/subscriptions","organizations_url":"https://api.github.com/users/s3lph/orgs","repos_url":"https://api.github.com/users/s3lph/repos","events_url":"https://api.github.com/users/s3lph/events{/privacy}","received_events_url":"https://api.github.com/users/s3lph/received_events","type":"User","site_admin":false},"body":"This allows the server to be instantly restarted, otherwise this may fail due to TCP's TIME_WAIT state.","created_at":"2018-08-07T19:45:29Z","updated_at":"2018-10-29T11:41:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64dfb09a3940d0f7e0e4b36e148cb001a4cbc398","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/onitake/daliserver/pulls/20/commits","review_comments_url":"https://api.github.com/repos/onitake/daliserver/pulls/20/comments","review_comment_url":"https://api.github.com/repos/onitake/daliserver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onitake/daliserver/issues/20/comments","statuses_url":"https://api.github.com/repos/onitake/daliserver/statuses/0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7","head":{"label":"s3lph:master","ref":"master","sha":"0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7","user":{"login":"s3lph","id":5564491,"node_id":"MDQ6VXNlcjU1NjQ0OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/5564491?v=4","gravatar_id":"","url":"https://api.github.com/users/s3lph","html_url":"https://github.com/s3lph","followers_url":"https://api.github.com/users/s3lph/followers","following_url":"https://api.github.com/users/s3lph/following{/other_user}","gists_url":"https://api.github.com/users/s3lph/gists{/gist_id}","starred_url":"https://api.github.com/users/s3lph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s3lph/subscriptions","organizations_url":"https://api.github.com/users/s3lph/orgs","repos_url":"https://api.github.com/users/s3lph/repos","events_url":"https://api.github.com/users/s3lph/events{/privacy}","received_events_url":"https://api.github.com/users/s3lph/received_events","type":"User","site_admin":false},"repo":{"id":143877749,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM4Nzc3NDk=","name":"daliserver","full_name":"s3lph/daliserver","private":false,"owner":{"login":"s3lph","id":5564491,"node_id":"MDQ6VXNlcjU1NjQ0OTE=","avatar_url":"https://avatars2.githubusercontent.com/u/5564491?v=4","gravatar_id":"","url":"https://api.github.com/users/s3lph","html_url":"https://github.com/s3lph","followers_url":"https://api.github.com/users/s3lph/followers","following_url":"https://api.github.com/users/s3lph/following{/other_user}","gists_url":"https://api.github.com/users/s3lph/gists{/gist_id}","starred_url":"https://api.github.com/users/s3lph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s3lph/subscriptions","organizations_url":"https://api.github.com/users/s3lph/orgs","repos_url":"https://api.github.com/users/s3lph/repos","events_url":"https://api.github.com/users/s3lph/events{/privacy}","received_events_url":"https://api.github.com/users/s3lph/received_events","type":"User","site_admin":false},"html_url":"https://github.com/s3lph/daliserver","description":"Command multiplexing server for the Tridonic DALI USB adapter","fork":true,"url":"https://api.github.com/repos/s3lph/daliserver","forks_url":"https://api.github.com/repos/s3lph/daliserver/forks","keys_url":"https://api.github.com/repos/s3lph/daliserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s3lph/daliserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s3lph/daliserver/teams","hooks_url":"https://api.github.com/repos/s3lph/daliserver/hooks","issue_events_url":"https://api.github.com/repos/s3lph/daliserver/issues/events{/number}","events_url":"https://api.github.com/repos/s3lph/daliserver/events","assignees_url":"https://api.github.com/repos/s3lph/daliserver/assignees{/user}","branches_url":"https://api.github.com/repos/s3lph/daliserver/branches{/branch}","tags_url":"https://api.github.com/repos/s3lph/daliserver/tags","blobs_url":"https://api.github.com/repos/s3lph/daliserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s3lph/daliserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s3lph/daliserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/s3lph/daliserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s3lph/daliserver/statuses/{sha}","languages_url":"https://api.github.com/repos/s3lph/daliserver/languages","stargazers_url":"https://api.github.com/repos/s3lph/daliserver/stargazers","contributors_url":"https://api.github.com/repos/s3lph/daliserver/contributors","subscribers_url":"https://api.github.com/repos/s3lph/daliserver/subscribers","subscription_url":"https://api.github.com/repos/s3lph/daliserver/subscription","commits_url":"https://api.github.com/repos/s3lph/daliserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/s3lph/daliserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/s3lph/daliserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/s3lph/daliserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/s3lph/daliserver/contents/{+path}","compare_url":"https://api.github.com/repos/s3lph/daliserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s3lph/daliserver/merges","archive_url":"https://api.github.com/repos/s3lph/daliserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s3lph/daliserver/downloads","issues_url":"https://api.github.com/repos/s3lph/daliserver/issues{/number}","pulls_url":"https://api.github.com/repos/s3lph/daliserver/pulls{/number}","milestones_url":"https://api.github.com/repos/s3lph/daliserver/milestones{/number}","notifications_url":"https://api.github.com/repos/s3lph/daliserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s3lph/daliserver/labels{/name}","releases_url":"https://api.github.com/repos/s3lph/daliserver/releases{/id}","deployments_url":"https://api.github.com/repos/s3lph/daliserver/deployments","created_at":"2018-08-07T13:33:19Z","updated_at":"2018-10-26T19:59:12Z","pushed_at":"2018-10-26T19:59:11Z","git_url":"git://github.com/s3lph/daliserver.git","ssh_url":"git@github.com:s3lph/daliserver.git","clone_url":"https://github.com/s3lph/daliserver.git","svn_url":"https://github.com/s3lph/daliserver","homepage":"","size":850,"stargazers_count":0,"watchers_count":0,"language":"C","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":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"onitake:master","ref":"master","sha":"e9c7100e57bec48e2afa590d4904fda0539aca43","user":{"login":"onitake","id":371687,"node_id":"MDQ6VXNlcjM3MTY4Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/371687?v=4","gravatar_id":"","url":"https://api.github.com/users/onitake","html_url":"https://github.com/onitake","followers_url":"https://api.github.com/users/onitake/followers","following_url":"https://api.github.com/users/onitake/following{/other_user}","gists_url":"https://api.github.com/users/onitake/gists{/gist_id}","starred_url":"https://api.github.com/users/onitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitake/subscriptions","organizations_url":"https://api.github.com/users/onitake/orgs","repos_url":"https://api.github.com/users/onitake/repos","events_url":"https://api.github.com/users/onitake/events{/privacy}","received_events_url":"https://api.github.com/users/onitake/received_events","type":"User","site_admin":false},"repo":{"id":1638279,"node_id":"MDEwOlJlcG9zaXRvcnkxNjM4Mjc5","name":"daliserver","full_name":"onitake/daliserver","private":false,"owner":{"login":"onitake","id":371687,"node_id":"MDQ6VXNlcjM3MTY4Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/371687?v=4","gravatar_id":"","url":"https://api.github.com/users/onitake","html_url":"https://github.com/onitake","followers_url":"https://api.github.com/users/onitake/followers","following_url":"https://api.github.com/users/onitake/following{/other_user}","gists_url":"https://api.github.com/users/onitake/gists{/gist_id}","starred_url":"https://api.github.com/users/onitake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitake/subscriptions","organizations_url":"https://api.github.com/users/onitake/orgs","repos_url":"https://api.github.com/users/onitake/repos","events_url":"https://api.github.com/users/onitake/events{/privacy}","received_events_url":"https://api.github.com/users/onitake/received_events","type":"User","site_admin":false},"html_url":"https://github.com/onitake/daliserver","description":"Command multiplexing server for the Tridonic DALI USB adapter","fork":false,"url":"https://api.github.com/repos/onitake/daliserver","forks_url":"https://api.github.com/repos/onitake/daliserver/forks","keys_url":"https://api.github.com/repos/onitake/daliserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onitake/daliserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onitake/daliserver/teams","hooks_url":"https://api.github.com/repos/onitake/daliserver/hooks","issue_events_url":"https://api.github.com/repos/onitake/daliserver/issues/events{/number}","events_url":"https://api.github.com/repos/onitake/daliserver/events","assignees_url":"https://api.github.com/repos/onitake/daliserver/assignees{/user}","branches_url":"https://api.github.com/repos/onitake/daliserver/branches{/branch}","tags_url":"https://api.github.com/repos/onitake/daliserver/tags","blobs_url":"https://api.github.com/repos/onitake/daliserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onitake/daliserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onitake/daliserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/onitake/daliserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onitake/daliserver/statuses/{sha}","languages_url":"https://api.github.com/repos/onitake/daliserver/languages","stargazers_url":"https://api.github.com/repos/onitake/daliserver/stargazers","contributors_url":"https://api.github.com/repos/onitake/daliserver/contributors","subscribers_url":"https://api.github.com/repos/onitake/daliserver/subscribers","subscription_url":"https://api.github.com/repos/onitake/daliserver/subscription","commits_url":"https://api.github.com/repos/onitake/daliserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/onitake/daliserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/onitake/daliserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/onitake/daliserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/onitake/daliserver/contents/{+path}","compare_url":"https://api.github.com/repos/onitake/daliserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onitake/daliserver/merges","archive_url":"https://api.github.com/repos/onitake/daliserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onitake/daliserver/downloads","issues_url":"https://api.github.com/repos/onitake/daliserver/issues{/number}","pulls_url":"https://api.github.com/repos/onitake/daliserver/pulls{/number}","milestones_url":"https://api.github.com/repos/onitake/daliserver/milestones{/number}","notifications_url":"https://api.github.com/repos/onitake/daliserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onitake/daliserver/labels{/name}","releases_url":"https://api.github.com/repos/onitake/daliserver/releases{/id}","deployments_url":"https://api.github.com/repos/onitake/daliserver/deployments","created_at":"2011-04-20T00:26:43Z","updated_at":"2018-10-24T20:01:14Z","pushed_at":"2018-10-26T19:59:12Z","git_url":"git://github.com/onitake/daliserver.git","ssh_url":"git@github.com:onitake/daliserver.git","clone_url":"https://github.com/onitake/daliserver.git","svn_url":"https://github.com/onitake/daliserver","homepage":"","size":849,"stargazers_count":29,"watchers_count":29,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":11,"open_issues":6,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/20"},"html":{"href":"https://github.com/onitake/daliserver/pull/20"},"issue":{"href":"https://api.github.com/repos/onitake/daliserver/issues/20"},"comments":{"href":"https://api.github.com/repos/onitake/daliserver/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onitake/daliserver/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/onitake/daliserver/statuses/0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7"}},"author_association":"NONE"}}
{"actor":{"display_login":"s3lph"}}