{"action":"created","comment":{"url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/comments/104591748","pull_request_review_id":25432197,"id":104591748,"diff_hunk":"@@ -345,16 +358,27 @@ impl Socket {\n     }\r\n \r\n     ///Accepts incoming connection.\r\n-    pub fn accept(&self) -> io::Result<(Socket, net::SocketAddr)> {\r\n+    pub fn accept(&self, flags: c_int) -> io::Result<(Socket, net::SocketAddr)> {\r\n+        if (flags & !(winapi::SOCK_NONBLOCK | winapi::SOCK_CLOEXEC)) != 0 {\r\n+            // `accept4()` also returns `EINVAL` if it receives an unknown flag\r\n+            return Err(io::Error::from_raw_os_error(winapi::WSAEINVAL));\r\n+        }\r\n+\r\n         unsafe {\r\n             let mut storage: winapi::SOCKADDR_STORAGE_LH = mem::zeroed();\r\n             let mut len = mem::size_of_val(&storage) as c_int;\r\n \r\n             match winapi::accept(self.inner, &mut storage as *mut _ as *mut _, &mut len) {\r\n                 winapi::INVALID_SOCKET => Err(io::Error::last_os_error()),\r\n                 sock @ _ => {\r\n+                    let sock = Socket { inner: sock };\r\n                     let addr = sockaddr_to_addr(&storage, len)?;\r\n-                    Ok((Socket { inner: sock, }, addr))\r\n+\r\n+                    // Emulate the two most common (and useful) `accept4` flags using `ioctl`/`fcntl`\r","path":"src/raw/windows.rs","position":378,"original_position":49,"commit_id":"c8394f3c3fec59eb89363b6c6c826b92961a6339","original_commit_id":"c8394f3c3fec59eb89363b6c6c826b92961a6339","user":{"login":"DoumanAsh","id":5676053,"avatar_url":"https://avatars0.githubusercontent.com/u/5676053?v=3","gravatar_id":"","url":"https://api.github.com/users/DoumanAsh","html_url":"https://github.com/DoumanAsh","followers_url":"https://api.github.com/users/DoumanAsh/followers","following_url":"https://api.github.com/users/DoumanAsh/following{/other_user}","gists_url":"https://api.github.com/users/DoumanAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/DoumanAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoumanAsh/subscriptions","organizations_url":"https://api.github.com/users/DoumanAsh/orgs","repos_url":"https://api.github.com/users/DoumanAsh/repos","events_url":"https://api.github.com/users/DoumanAsh/events{/privacy}","received_events_url":"https://api.github.com/users/DoumanAsh/received_events","type":"User","site_admin":false},"body":"Comment on emulation isn't needed as i believe it is already clear from existence of flags.\r\nBut please add description of available flags to public documentation","created_at":"2017-03-07T05:30:10Z","updated_at":"2017-03-07T05:30:44Z","html_url":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1#discussion_r104591748","pull_request_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/comments/104591748"},"html":{"href":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1#discussion_r104591748"},"pull_request":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1","id":109346599,"html_url":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1","diff_url":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1.diff","patch_url":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1.patch","issue_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/1","number":1,"state":"open","locked":false,"title":"[WIP/CI] New stuff","user":{"login":"alexander255","id":246386,"avatar_url":"https://avatars2.githubusercontent.com/u/246386?v=3","gravatar_id":"","url":"https://api.github.com/users/alexander255","html_url":"https://github.com/alexander255","followers_url":"https://api.github.com/users/alexander255/followers","following_url":"https://api.github.com/users/alexander255/following{/other_user}","gists_url":"https://api.github.com/users/alexander255/gists{/gist_id}","starred_url":"https://api.github.com/users/alexander255/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexander255/subscriptions","organizations_url":"https://api.github.com/users/alexander255/orgs","repos_url":"https://api.github.com/users/alexander255/repos","events_url":"https://api.github.com/users/alexander255/events{/privacy}","received_events_url":"https://api.github.com/users/alexander255/received_events","type":"User","site_admin":false},"body":"I like what you are doing with this library, but I'm missing some features/options that I think ought to be available. Therefor all but one commit are BREAKING CHANGES and you may not agree on the way I've implemented some of these things.\r\n\r\nChanges right now, in particular, are:\r\n\r\n  * Add flags parameter to `send*` and `recv*`\r\n  * Update Windows codebase to use `winapi` and friends instead of the current homebrew approach\r\n  * Add support for a Python-style `set_inheritable` (the code is a 1:1 translation from the CPython code base as well, btw)\r\n  * Add a flags parameter to `accept` INCLUDING EMULATION for systems that do not (yet) have the corresponding `accept4` system call\r\n    - Without this one is pretty much forced to always use `set_blocking` and `set_inheritable` manually, if portable blocking and inheritance behaviour for the created file descriptor is desired\r\n    - I'd go even as far as to say that extra flags on the `_type` parameter should be emulated in a similar way\r\n\r\nThings still missing:\r\n\r\n  * TESTS!\r\n  * CI for macOS and Windowse\r\n  * Replace `std::net::SocketAddr` with something that describe all supported operating system socket address types, not just IPv4 and IPv6\r\n\r\nPlease let me know your thoughts on this and whether you think that this is something that aligns with your ideas on what this library should be.","created_at":"2017-03-06T20:54:35Z","updated_at":"2017-03-07T05:30:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed2dee1a28c59b10f68ad6101cdd7177ecbf0600","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1/commits","review_comments_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1/comments","review_comment_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/1/comments","statuses_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/statuses/c8394f3c3fec59eb89363b6c6c826b92961a6339","head":{"label":"alexander255:master","ref":"master","sha":"c8394f3c3fec59eb89363b6c6c826b92961a6339","user":{"login":"alexander255","id":246386,"avatar_url":"https://avatars2.githubusercontent.com/u/246386?v=3","gravatar_id":"","url":"https://api.github.com/users/alexander255","html_url":"https://github.com/alexander255","followers_url":"https://api.github.com/users/alexander255/followers","following_url":"https://api.github.com/users/alexander255/following{/other_user}","gists_url":"https://api.github.com/users/alexander255/gists{/gist_id}","starred_url":"https://api.github.com/users/alexander255/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexander255/subscriptions","organizations_url":"https://api.github.com/users/alexander255/orgs","repos_url":"https://api.github.com/users/alexander255/repos","events_url":"https://api.github.com/users/alexander255/events{/privacy}","received_events_url":"https://api.github.com/users/alexander255/received_events","type":"User","site_admin":false},"repo":{"id":84117726,"name":"lazy-socket.rs","full_name":"alexander255/lazy-socket.rs","owner":{"login":"alexander255","id":246386,"avatar_url":"https://avatars2.githubusercontent.com/u/246386?v=3","gravatar_id":"","url":"https://api.github.com/users/alexander255","html_url":"https://github.com/alexander255","followers_url":"https://api.github.com/users/alexander255/followers","following_url":"https://api.github.com/users/alexander255/following{/other_user}","gists_url":"https://api.github.com/users/alexander255/gists{/gist_id}","starred_url":"https://api.github.com/users/alexander255/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexander255/subscriptions","organizations_url":"https://api.github.com/users/alexander255/orgs","repos_url":"https://api.github.com/users/alexander255/repos","events_url":"https://api.github.com/users/alexander255/events{/privacy}","received_events_url":"https://api.github.com/users/alexander255/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexander255/lazy-socket.rs","description":"Low level Raw Socket API. WIP","fork":true,"url":"https://api.github.com/repos/alexander255/lazy-socket.rs","forks_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/forks","keys_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/teams","hooks_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/hooks","issue_events_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/issues/events{/number}","events_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/events","assignees_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/assignees{/user}","branches_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/branches{/branch}","tags_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/tags","blobs_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/statuses/{sha}","languages_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/languages","stargazers_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/stargazers","contributors_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/contributors","subscribers_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/subscribers","subscription_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/subscription","commits_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/contents/{+path}","compare_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/merges","archive_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/downloads","issues_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/issues{/number}","pulls_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/pulls{/number}","milestones_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/milestones{/number}","notifications_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/labels{/name}","releases_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/releases{/id}","deployments_url":"https://api.github.com/repos/alexander255/lazy-socket.rs/deployments","created_at":"2017-03-06T20:29:36Z","updated_at":"2017-03-06T20:29:37Z","pushed_at":"2017-03-06T22:21:34Z","git_url":"git://github.com/alexander255/lazy-socket.rs.git","ssh_url":"git@github.com:alexander255/lazy-socket.rs.git","clone_url":"https://github.com/alexander255/lazy-socket.rs.git","svn_url":"https://github.com/alexander255/lazy-socket.rs","homepage":"https://crates.io/crates/lazy-socket","size":31,"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":"DoumanAsh:master","ref":"master","sha":"931f72deb19fc9fbf30ab9e47285bbe2c8f5d997","user":{"login":"DoumanAsh","id":5676053,"avatar_url":"https://avatars0.githubusercontent.com/u/5676053?v=3","gravatar_id":"","url":"https://api.github.com/users/DoumanAsh","html_url":"https://github.com/DoumanAsh","followers_url":"https://api.github.com/users/DoumanAsh/followers","following_url":"https://api.github.com/users/DoumanAsh/following{/other_user}","gists_url":"https://api.github.com/users/DoumanAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/DoumanAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoumanAsh/subscriptions","organizations_url":"https://api.github.com/users/DoumanAsh/orgs","repos_url":"https://api.github.com/users/DoumanAsh/repos","events_url":"https://api.github.com/users/DoumanAsh/events{/privacy}","received_events_url":"https://api.github.com/users/DoumanAsh/received_events","type":"User","site_admin":false},"repo":{"id":80191903,"name":"lazy-socket.rs","full_name":"DoumanAsh/lazy-socket.rs","owner":{"login":"DoumanAsh","id":5676053,"avatar_url":"https://avatars0.githubusercontent.com/u/5676053?v=3","gravatar_id":"","url":"https://api.github.com/users/DoumanAsh","html_url":"https://github.com/DoumanAsh","followers_url":"https://api.github.com/users/DoumanAsh/followers","following_url":"https://api.github.com/users/DoumanAsh/following{/other_user}","gists_url":"https://api.github.com/users/DoumanAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/DoumanAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoumanAsh/subscriptions","organizations_url":"https://api.github.com/users/DoumanAsh/orgs","repos_url":"https://api.github.com/users/DoumanAsh/repos","events_url":"https://api.github.com/users/DoumanAsh/events{/privacy}","received_events_url":"https://api.github.com/users/DoumanAsh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DoumanAsh/lazy-socket.rs","description":"Low level Raw Socket API. WIP","fork":false,"url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs","forks_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/forks","keys_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/teams","hooks_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/hooks","issue_events_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/events{/number}","events_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/events","assignees_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/assignees{/user}","branches_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/branches{/branch}","tags_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/tags","blobs_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/statuses/{sha}","languages_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/languages","stargazers_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/stargazers","contributors_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/contributors","subscribers_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/subscribers","subscription_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/subscription","commits_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/contents/{+path}","compare_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/merges","archive_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/downloads","issues_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues{/number}","pulls_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls{/number}","milestones_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/milestones{/number}","notifications_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/labels{/name}","releases_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/releases{/id}","deployments_url":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/deployments","created_at":"2017-01-27T08:30:15Z","updated_at":"2017-01-28T07:54:07Z","pushed_at":"2017-03-06T22:21:35Z","git_url":"git://github.com/DoumanAsh/lazy-socket.rs.git","ssh_url":"git@github.com:DoumanAsh/lazy-socket.rs.git","clone_url":"https://github.com/DoumanAsh/lazy-socket.rs.git","svn_url":"https://github.com/DoumanAsh/lazy-socket.rs","homepage":"https://crates.io/crates/lazy-socket","size":37,"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/DoumanAsh/lazy-socket.rs/pulls/1"},"html":{"href":"https://github.com/DoumanAsh/lazy-socket.rs/pull/1"},"issue":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/1"},"comments":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/DoumanAsh/lazy-socket.rs/statuses/c8394f3c3fec59eb89363b6c6c826b92961a6339"}}}}
{"actor":{"display_login":"DoumanAsh"}}