{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/comments/173878260","pull_request_review_id":103139986,"id":173878260,"diff_hunk":"@@ -598,14 +600,26 @@ class BaseSocketChannel<T: BaseSocket>: SelectableChannel, ChannelCore {\n \n             // Call before triggering the close of the Channel.\n             pipeline.fireChannelReadComplete0()\n-            close0(error: err, mode: .all, promise: nil)\n+            \n+            if closeOnReadError(err) {\n+                close0(error: err, mode: .all, promise: nil)\n+            }\n \n             return\n         }\n         pipeline.fireChannelReadComplete0()\n         readIfNeeded0()\n     }\n \n+    /// Returns `true` if the `Channel` should be closed as result of the given `Error` which happened during `readFromSocket`.\n+    ///\n+    /// - parameters:\n+    ///     - err: The `Error` which was thrown by `readFromSocket`.\n+    /// - returns: `true` if the `Channel` should be closed, `false` otherwise.\n+    fileprivate func closeOnReadError(_ err: Error) -> Bool {","path":"Sources/NIO/SocketChannel.swift","position":32,"original_position":32,"commit_id":"ddbdee2aad4b2da05257e836f09aa94b39ed4d95","original_commit_id":"ddbdee2aad4b2da05257e836f09aa94b39ed4d95","user":{"login":"weissi","id":624238,"avatar_url":"https://avatars2.githubusercontent.com/u/624238?v=4","gravatar_id":"","url":"https://api.github.com/users/weissi","html_url":"https://github.com/weissi","followers_url":"https://api.github.com/users/weissi/followers","following_url":"https://api.github.com/users/weissi/following{/other_user}","gists_url":"https://api.github.com/users/weissi/gists{/gist_id}","starred_url":"https://api.github.com/users/weissi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weissi/subscriptions","organizations_url":"https://api.github.com/users/weissi/orgs","repos_url":"https://api.github.com/users/weissi/repos","events_url":"https://api.github.com/users/weissi/events{/privacy}","received_events_url":"https://api.github.com/users/weissi/received_events","type":"User","site_admin":false},"body":"clearly a nit but `closeOnReadError` reads like it would close something. I'd rename it to `shouldCloseOnReadError`","created_at":"2018-03-12T17:20:47Z","updated_at":"2018-03-12T17:21:42Z","html_url":"https://github.com/apple/swift-nio/pull/125#discussion_r173878260","pull_request_url":"https://api.github.com/repos/apple/swift-nio/pulls/125","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments/173878260"},"html":{"href":"https://github.com/apple/swift-nio/pull/125#discussion_r173878260"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/125"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/125","id":174212770,"html_url":"https://github.com/apple/swift-nio/pull/125","diff_url":"https://github.com/apple/swift-nio/pull/125.diff","patch_url":"https://github.com/apple/swift-nio/pull/125.patch","issue_url":"https://api.github.com/repos/apple/swift-nio/issues/125","number":125,"state":"open","locked":false,"title":"Don't close ServerSocketChannel when accept fails with ECONNABORTED /…","user":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"body":"… EMFILE / ENFILE, ENOBUFS. ENOMEM.\r\n\r\nMotivation:\r\n\r\nWe should not close the server socket when accept fails with ECONNABORTED / EMFILE / ENFILE, ENOBUFS. ENOMEM as generally speaking these may be \"recoverable\" once some existing connections were closed for example. It's possible to implement a backoff strategy for these with a ChannelHandler.\r\n\r\nModifications:\r\n\r\n- Special handle of ECONNABORTED / EMFILE / ENFILE, ENOBUFS. ENOMEM for ServerSocketChannel.\r\n\r\nResult:\r\n\r\nNot close servet socket for errors from which it is possible to recover.","created_at":"2018-03-11T09:44:43Z","updated_at":"2018-03-12T17:21:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5855aebe9692b7743c5ca1fe018afa90e9c436dc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-nio/pulls/125/commits","review_comments_url":"https://api.github.com/repos/apple/swift-nio/pulls/125/comments","review_comment_url":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift-nio/issues/125/comments","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/ddbdee2aad4b2da05257e836f09aa94b39ed4d95","head":{"label":"normanmaurer:accept_error","ref":"accept_error","sha":"ddbdee2aad4b2da05257e836f09aa94b39ed4d95","user":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"repo":{"id":123526297,"name":"swift-nio","full_name":"normanmaurer/swift-nio","owner":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/normanmaurer/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":true,"url":"https://api.github.com/repos/normanmaurer/swift-nio","forks_url":"https://api.github.com/repos/normanmaurer/swift-nio/forks","keys_url":"https://api.github.com/repos/normanmaurer/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/normanmaurer/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/normanmaurer/swift-nio/teams","hooks_url":"https://api.github.com/repos/normanmaurer/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/normanmaurer/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/normanmaurer/swift-nio/events","assignees_url":"https://api.github.com/repos/normanmaurer/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/normanmaurer/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/normanmaurer/swift-nio/tags","blobs_url":"https://api.github.com/repos/normanmaurer/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/normanmaurer/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/normanmaurer/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/normanmaurer/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/normanmaurer/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/normanmaurer/swift-nio/languages","stargazers_url":"https://api.github.com/repos/normanmaurer/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/normanmaurer/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/normanmaurer/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/normanmaurer/swift-nio/subscription","commits_url":"https://api.github.com/repos/normanmaurer/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/normanmaurer/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/normanmaurer/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/normanmaurer/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/normanmaurer/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/normanmaurer/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/normanmaurer/swift-nio/merges","archive_url":"https://api.github.com/repos/normanmaurer/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/normanmaurer/swift-nio/downloads","issues_url":"https://api.github.com/repos/normanmaurer/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/normanmaurer/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/normanmaurer/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/normanmaurer/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/normanmaurer/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/normanmaurer/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/normanmaurer/swift-nio/deployments","created_at":"2018-03-02T03:37:41Z","updated_at":"2018-03-02T03:37:44Z","pushed_at":"2018-03-12T12:53:54Z","git_url":"git://github.com/normanmaurer/swift-nio.git","ssh_url":"git@github.com:normanmaurer/swift-nio.git","clone_url":"https://github.com/normanmaurer/swift-nio.git","svn_url":"https://github.com/normanmaurer/swift-nio","homepage":"","size":2781,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"43dd9c0b336e7312458201fe3f8cd9ad807ac24c","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":120498971,"name":"swift-nio","full_name":"apple/swift-nio","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":false,"url":"https://api.github.com/repos/apple/swift-nio","forks_url":"https://api.github.com/repos/apple/swift-nio/forks","keys_url":"https://api.github.com/repos/apple/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift-nio/teams","hooks_url":"https://api.github.com/repos/apple/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/apple/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift-nio/events","assignees_url":"https://api.github.com/repos/apple/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift-nio/tags","blobs_url":"https://api.github.com/repos/apple/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift-nio/languages","stargazers_url":"https://api.github.com/repos/apple/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/apple/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/apple/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/apple/swift-nio/subscription","commits_url":"https://api.github.com/repos/apple/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift-nio/merges","archive_url":"https://api.github.com/repos/apple/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift-nio/downloads","issues_url":"https://api.github.com/repos/apple/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift-nio/deployments","created_at":"2018-02-06T17:47:31Z","updated_at":"2018-03-12T17:11:52Z","pushed_at":"2018-03-12T17:21:20Z","git_url":"git://github.com/apple/swift-nio.git","ssh_url":"git@github.com:apple/swift-nio.git","clone_url":"https://github.com/apple/swift-nio.git","svn_url":"https://github.com/apple/swift-nio","homepage":"","size":3460,"stargazers_count":2927,"watchers_count":2927,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":100,"mirror_url":null,"archived":false,"open_issues_count":27,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":100,"open_issues":27,"watchers":2927,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/125"},"html":{"href":"https://github.com/apple/swift-nio/pull/125"},"issue":{"href":"https://api.github.com/repos/apple/swift-nio/issues/125"},"comments":{"href":"https://api.github.com/repos/apple/swift-nio/issues/125/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/125/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/125/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-nio/statuses/ddbdee2aad4b2da05257e836f09aa94b39ed4d95"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"weissi"}}