{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/SignalR/pulls/comments/174972085","pull_request_review_id":104426061,"id":174972085,"diff_hunk":"@@ -107,23 +108,45 @@ public override void Dispose()\n             {\n                 try\n                 {\n-                    await _input.WaitToReadAsync();\n-\n-                    if (_input.TryRead(out var message))\n+                    if (_internalBuffer.Buffer == null || _internalBuffer.Buffer.Length == 0)\n                     {\n-                        if (message.MessageType == WebSocketMessageType.Close)\n+                        await _input.WaitToReadAsync();\n+\n+                        WebSocketMessage message;\n+                        if (_input.TryRead(out message))\n                         {\n-                            _state = WebSocketState.CloseReceived;\n-                            _closeStatus = message.CloseStatus;\n-                            _closeStatusDescription = message.CloseStatusDescription;\n-                            return new WebSocketReceiveResult(0, WebSocketMessageType.Close, true, message.CloseStatus, message.CloseStatusDescription);\n+                            if (message.MessageType == WebSocketMessageType.Close)\n+                            {\n+                                _state = WebSocketState.CloseReceived;\n+                                _closeStatus = message.CloseStatus;\n+                                _closeStatusDescription = message.CloseStatusDescription;\n+                                return new WebSocketReceiveResult(0, WebSocketMessageType.Close, true, message.CloseStatus, message.CloseStatusDescription);\n+                            }\n+\n+                            _internalBuffer = message;\n                         }\n+                    }\n \n-                        // REVIEW: This assumes the buffer passed in is > the buffer received","path":"test/Microsoft.AspNetCore.Sockets.Tests/TestWebSocketConnectionFeature.cs","position":39,"original_position":39,"commit_id":"b96d8fe32fbeac103bc1cd139ba9576b049ab8f3","original_commit_id":"a29aa3e534adc408487304e242205736f7262c05","user":{"login":"davidfowl","id":95136,"avatar_url":"https://avatars3.githubusercontent.com/u/95136?v=4","gravatar_id":"","url":"https://api.github.com/users/davidfowl","html_url":"https://github.com/davidfowl","followers_url":"https://api.github.com/users/davidfowl/followers","following_url":"https://api.github.com/users/davidfowl/following{/other_user}","gists_url":"https://api.github.com/users/davidfowl/gists{/gist_id}","starred_url":"https://api.github.com/users/davidfowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidfowl/subscriptions","organizations_url":"https://api.github.com/users/davidfowl/orgs","repos_url":"https://api.github.com/users/davidfowl/repos","events_url":"https://api.github.com/users/davidfowl/events{/privacy}","received_events_url":"https://api.github.com/users/davidfowl/received_events","type":"User","site_admin":false},"body":"@BrennanConroy does this code work? If it's tested enough then it's fine.","created_at":"2018-03-16T00:38:16Z","updated_at":"2018-03-16T00:38:16Z","html_url":"https://github.com/aspnet/SignalR/pull/1603#discussion_r174972085","pull_request_url":"https://api.github.com/repos/aspnet/SignalR/pulls/1603","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/comments/174972085"},"html":{"href":"https://github.com/aspnet/SignalR/pull/1603#discussion_r174972085"},"pull_request":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/1603"}},"in_reply_to_id":174840444},"pull_request":{"url":"https://api.github.com/repos/aspnet/SignalR/pulls/1603","id":175116989,"html_url":"https://github.com/aspnet/SignalR/pull/1603","diff_url":"https://github.com/aspnet/SignalR/pull/1603.diff","patch_url":"https://github.com/aspnet/SignalR/pull/1603.patch","issue_url":"https://api.github.com/repos/aspnet/SignalR/issues/1603","number":1603,"state":"open","locked":false,"title":"Use 0 byte reads in WebSockets to lower Idle Connection memory usage","user":{"login":"BrennanConroy","id":7574801,"avatar_url":"https://avatars0.githubusercontent.com/u/7574801?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanConroy","html_url":"https://github.com/BrennanConroy","followers_url":"https://api.github.com/users/BrennanConroy/followers","following_url":"https://api.github.com/users/BrennanConroy/following{/other_user}","gists_url":"https://api.github.com/users/BrennanConroy/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanConroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanConroy/subscriptions","organizations_url":"https://api.github.com/users/BrennanConroy/orgs","repos_url":"https://api.github.com/users/BrennanConroy/repos","events_url":"https://api.github.com/users/BrennanConroy/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanConroy/received_events","type":"User","site_admin":false},"body":"#1582","created_at":"2018-03-15T00:03:42Z","updated_at":"2018-03-16T00:38:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59835c314132daa757f70d8edd933e957bee5c00","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/SignalR/pulls/1603/commits","review_comments_url":"https://api.github.com/repos/aspnet/SignalR/pulls/1603/comments","review_comment_url":"https://api.github.com/repos/aspnet/SignalR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/SignalR/issues/1603/comments","statuses_url":"https://api.github.com/repos/aspnet/SignalR/statuses/b96d8fe32fbeac103bc1cd139ba9576b049ab8f3","head":{"label":"aspnet:brecon/0read","ref":"brecon/0read","sha":"b96d8fe32fbeac103bc1cd139ba9576b049ab8f3","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":71159589,"name":"SignalR","full_name":"aspnet/SignalR","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/SignalR","description":"Incredibly simple real-time web for ASP.NET Core","fork":false,"url":"https://api.github.com/repos/aspnet/SignalR","forks_url":"https://api.github.com/repos/aspnet/SignalR/forks","keys_url":"https://api.github.com/repos/aspnet/SignalR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/SignalR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/SignalR/teams","hooks_url":"https://api.github.com/repos/aspnet/SignalR/hooks","issue_events_url":"https://api.github.com/repos/aspnet/SignalR/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/SignalR/events","assignees_url":"https://api.github.com/repos/aspnet/SignalR/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/SignalR/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/SignalR/tags","blobs_url":"https://api.github.com/repos/aspnet/SignalR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/SignalR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/SignalR/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/SignalR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/SignalR/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/SignalR/languages","stargazers_url":"https://api.github.com/repos/aspnet/SignalR/stargazers","contributors_url":"https://api.github.com/repos/aspnet/SignalR/contributors","subscribers_url":"https://api.github.com/repos/aspnet/SignalR/subscribers","subscription_url":"https://api.github.com/repos/aspnet/SignalR/subscription","commits_url":"https://api.github.com/repos/aspnet/SignalR/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/SignalR/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/SignalR/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/SignalR/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/SignalR/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/SignalR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/SignalR/merges","archive_url":"https://api.github.com/repos/aspnet/SignalR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/SignalR/downloads","issues_url":"https://api.github.com/repos/aspnet/SignalR/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/SignalR/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/SignalR/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/SignalR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/SignalR/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/SignalR/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/SignalR/deployments","created_at":"2016-10-17T16:39:15Z","updated_at":"2018-03-15T08:37:10Z","pushed_at":"2018-03-16T00:25:42Z","git_url":"git://github.com/aspnet/SignalR.git","ssh_url":"git@github.com:aspnet/SignalR.git","clone_url":"https://github.com/aspnet/SignalR.git","svn_url":"https://github.com/aspnet/SignalR","homepage":null,"size":4745,"stargazers_count":1534,"watchers_count":1534,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":259,"mirror_url":null,"archived":false,"open_issues_count":142,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":259,"open_issues":142,"watchers":1534,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"2b68db873aceb70b2911f755d543395e9ba14b85","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":71159589,"name":"SignalR","full_name":"aspnet/SignalR","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars3.githubusercontent.com/u/6476660?v=4","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/SignalR","description":"Incredibly simple real-time web for ASP.NET Core","fork":false,"url":"https://api.github.com/repos/aspnet/SignalR","forks_url":"https://api.github.com/repos/aspnet/SignalR/forks","keys_url":"https://api.github.com/repos/aspnet/SignalR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/SignalR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/SignalR/teams","hooks_url":"https://api.github.com/repos/aspnet/SignalR/hooks","issue_events_url":"https://api.github.com/repos/aspnet/SignalR/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/SignalR/events","assignees_url":"https://api.github.com/repos/aspnet/SignalR/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/SignalR/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/SignalR/tags","blobs_url":"https://api.github.com/repos/aspnet/SignalR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/SignalR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/SignalR/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/SignalR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/SignalR/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/SignalR/languages","stargazers_url":"https://api.github.com/repos/aspnet/SignalR/stargazers","contributors_url":"https://api.github.com/repos/aspnet/SignalR/contributors","subscribers_url":"https://api.github.com/repos/aspnet/SignalR/subscribers","subscription_url":"https://api.github.com/repos/aspnet/SignalR/subscription","commits_url":"https://api.github.com/repos/aspnet/SignalR/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/SignalR/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/SignalR/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/SignalR/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/SignalR/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/SignalR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/SignalR/merges","archive_url":"https://api.github.com/repos/aspnet/SignalR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/SignalR/downloads","issues_url":"https://api.github.com/repos/aspnet/SignalR/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/SignalR/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/SignalR/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/SignalR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/SignalR/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/SignalR/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/SignalR/deployments","created_at":"2016-10-17T16:39:15Z","updated_at":"2018-03-15T08:37:10Z","pushed_at":"2018-03-16T00:25:42Z","git_url":"git://github.com/aspnet/SignalR.git","ssh_url":"git@github.com:aspnet/SignalR.git","clone_url":"https://github.com/aspnet/SignalR.git","svn_url":"https://github.com/aspnet/SignalR","homepage":null,"size":4745,"stargazers_count":1534,"watchers_count":1534,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":259,"mirror_url":null,"archived":false,"open_issues_count":142,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":259,"open_issues":142,"watchers":1534,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/1603"},"html":{"href":"https://github.com/aspnet/SignalR/pull/1603"},"issue":{"href":"https://api.github.com/repos/aspnet/SignalR/issues/1603"},"comments":{"href":"https://api.github.com/repos/aspnet/SignalR/issues/1603/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/1603/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/1603/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/SignalR/statuses/b96d8fe32fbeac103bc1cd139ba9576b049ab8f3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"davidfowl"}}