{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/145017313","pull_request_review_id":69754468,"id":145017313,"diff_hunk":"@@ -1346,25 +1346,27 @@ internal void FinishWrite()\n \n             lock (this)\n             {\n-                object obj = _queuedWriteStateRequest;\n-                if (obj == null)\n-                {\n-                    // A repeated call.\n-                    return;\n-                }\n+                HandleWriteCallback();\n+            }\n+        }\n \n-                _queuedWriteStateRequest = null;\n-                if (obj is LazyAsyncResult)\n-                {\n-                    // Sync handshake is waiting on other thread.\n-                    ((LazyAsyncResult)obj).InvokeCallback();\n-                }\n-                else\n-                {\n-                    // Async handshake is pending, start it on other thread.\n-                    // Consider: we could start it in on this thread but that will delay THIS write completion\n+        private void HandleWriteCallback()\n+        {\n+            object obj = _queuedWriteStateRequest;\n+            _queuedWriteStateRequest = null;\n+            switch (obj)\n+            {\n+                case null:\n+                    break;\n+                case LazyAsyncResult lazy:\n+                    lazy.InvokeCallback();\n+                    break;\n+                case TaskCompletionSource<int> tsc:","path":"src/System.Net.Security/src/System/Net/Security/SslState.cs","position":35,"original_position":35,"commit_id":"7a132a4d2694413bab5762b7af6ef5606c7b8724","original_commit_id":"7a132a4d2694413bab5762b7af6ef5606c7b8724","user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars0.githubusercontent.com/u/2642209?v=4","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"body":"Nit: tcs?","created_at":"2017-10-17T02:56:15Z","updated_at":"2017-10-17T02:56:15Z","html_url":"https://github.com/dotnet/corefx/pull/24492#discussion_r145017313","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/24492","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/145017313"},"html":{"href":"https://github.com/dotnet/corefx/pull/24492#discussion_r145017313"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/24492"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/24492","id":145260626,"html_url":"https://github.com/dotnet/corefx/pull/24492","diff_url":"https://github.com/dotnet/corefx/pull/24492.diff","patch_url":"https://github.com/dotnet/corefx/pull/24492.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/24492","number":24492,"state":"open","locked":false,"title":"SSLStream - Fix write renegotiation and make a single function for it","user":{"login":"Drawaes","id":16406969,"avatar_url":"https://avatars2.githubusercontent.com/u/16406969?v=4","gravatar_id":"","url":"https://api.github.com/users/Drawaes","html_url":"https://github.com/Drawaes","followers_url":"https://api.github.com/users/Drawaes/followers","following_url":"https://api.github.com/users/Drawaes/following{/other_user}","gists_url":"https://api.github.com/users/Drawaes/gists{/gist_id}","starred_url":"https://api.github.com/users/Drawaes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drawaes/subscriptions","organizations_url":"https://api.github.com/users/Drawaes/orgs","repos_url":"https://api.github.com/users/Drawaes/repos","events_url":"https://api.github.com/users/Drawaes/events{/privacy}","received_events_url":"https://api.github.com/users/Drawaes/received_events","type":"User","site_admin":false},"body":"I was taking a hard look at the code for triggering the callback after an async renegotiation for both read and write. The write side is currently missing the TaskCompletionSource call that was added, but seemed to drop out of my PR. \r\n\r\nI have put this in and moved the duplicate code to a single function which is what I was prototyping on the read side to make that full async. ","created_at":"2017-10-06T22:48:57Z","updated_at":"2017-10-17T02:56:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c686013c77b908329df412ee6a48bf40dbf705a4","assignee":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars0.githubusercontent.com/u/2642209?v=4","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"assignees":[{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars0.githubusercontent.com/u/2642209?v=4","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},{"login":"Priya91","id":7853870,"avatar_url":"https://avatars3.githubusercontent.com/u/7853870?v=4","gravatar_id":"","url":"https://api.github.com/users/Priya91","html_url":"https://github.com/Priya91","followers_url":"https://api.github.com/users/Priya91/followers","following_url":"https://api.github.com/users/Priya91/following{/other_user}","gists_url":"https://api.github.com/users/Priya91/gists{/gist_id}","starred_url":"https://api.github.com/users/Priya91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Priya91/subscriptions","organizations_url":"https://api.github.com/users/Priya91/orgs","repos_url":"https://api.github.com/users/Priya91/repos","events_url":"https://api.github.com/users/Priya91/events{/privacy}","received_events_url":"https://api.github.com/users/Priya91/received_events","type":"User","site_admin":false},{"login":"geoffkizer","id":12518809,"avatar_url":"https://avatars2.githubusercontent.com/u/12518809?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffkizer","html_url":"https://github.com/geoffkizer","followers_url":"https://api.github.com/users/geoffkizer/followers","following_url":"https://api.github.com/users/geoffkizer/following{/other_user}","gists_url":"https://api.github.com/users/geoffkizer/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffkizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffkizer/subscriptions","organizations_url":"https://api.github.com/users/geoffkizer/orgs","repos_url":"https://api.github.com/users/geoffkizer/repos","events_url":"https://api.github.com/users/geoffkizer/events{/privacy}","received_events_url":"https://api.github.com/users/geoffkizer/received_events","type":"User","site_admin":false},{"login":"Drawaes","id":16406969,"avatar_url":"https://avatars2.githubusercontent.com/u/16406969?v=4","gravatar_id":"","url":"https://api.github.com/users/Drawaes","html_url":"https://github.com/Drawaes","followers_url":"https://api.github.com/users/Drawaes/followers","following_url":"https://api.github.com/users/Drawaes/following{/other_user}","gists_url":"https://api.github.com/users/Drawaes/gists{/gist_id}","starred_url":"https://api.github.com/users/Drawaes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drawaes/subscriptions","organizations_url":"https://api.github.com/users/Drawaes/orgs","repos_url":"https://api.github.com/users/Drawaes/repos","events_url":"https://api.github.com/users/Drawaes/events{/privacy}","received_events_url":"https://api.github.com/users/Drawaes/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"bartonjs","id":10642668,"avatar_url":"https://avatars3.githubusercontent.com/u/10642668?v=4","gravatar_id":"","url":"https://api.github.com/users/bartonjs","html_url":"https://github.com/bartonjs","followers_url":"https://api.github.com/users/bartonjs/followers","following_url":"https://api.github.com/users/bartonjs/following{/other_user}","gists_url":"https://api.github.com/users/bartonjs/gists{/gist_id}","starred_url":"https://api.github.com/users/bartonjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartonjs/subscriptions","organizations_url":"https://api.github.com/users/bartonjs/orgs","repos_url":"https://api.github.com/users/bartonjs/repos","events_url":"https://api.github.com/users/bartonjs/events{/privacy}","received_events_url":"https://api.github.com/users/bartonjs/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/24492/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/24492/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/24492/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/7a132a4d2694413bab5762b7af6ef5606c7b8724","head":{"label":"Drawaes:FixWriteRenegotiation","ref":"FixWriteRenegotiation","sha":"7a132a4d2694413bab5762b7af6ef5606c7b8724","user":{"login":"Drawaes","id":16406969,"avatar_url":"https://avatars2.githubusercontent.com/u/16406969?v=4","gravatar_id":"","url":"https://api.github.com/users/Drawaes","html_url":"https://github.com/Drawaes","followers_url":"https://api.github.com/users/Drawaes/followers","following_url":"https://api.github.com/users/Drawaes/following{/other_user}","gists_url":"https://api.github.com/users/Drawaes/gists{/gist_id}","starred_url":"https://api.github.com/users/Drawaes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drawaes/subscriptions","organizations_url":"https://api.github.com/users/Drawaes/orgs","repos_url":"https://api.github.com/users/Drawaes/repos","events_url":"https://api.github.com/users/Drawaes/events{/privacy}","received_events_url":"https://api.github.com/users/Drawaes/received_events","type":"User","site_admin":false},"repo":{"id":95828445,"name":"corefx","full_name":"Drawaes/corefx","owner":{"login":"Drawaes","id":16406969,"avatar_url":"https://avatars2.githubusercontent.com/u/16406969?v=4","gravatar_id":"","url":"https://api.github.com/users/Drawaes","html_url":"https://github.com/Drawaes","followers_url":"https://api.github.com/users/Drawaes/followers","following_url":"https://api.github.com/users/Drawaes/following{/other_user}","gists_url":"https://api.github.com/users/Drawaes/gists{/gist_id}","starred_url":"https://api.github.com/users/Drawaes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drawaes/subscriptions","organizations_url":"https://api.github.com/users/Drawaes/orgs","repos_url":"https://api.github.com/users/Drawaes/repos","events_url":"https://api.github.com/users/Drawaes/events{/privacy}","received_events_url":"https://api.github.com/users/Drawaes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Drawaes/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/Drawaes/corefx","forks_url":"https://api.github.com/repos/Drawaes/corefx/forks","keys_url":"https://api.github.com/repos/Drawaes/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Drawaes/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Drawaes/corefx/teams","hooks_url":"https://api.github.com/repos/Drawaes/corefx/hooks","issue_events_url":"https://api.github.com/repos/Drawaes/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/Drawaes/corefx/events","assignees_url":"https://api.github.com/repos/Drawaes/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/Drawaes/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/Drawaes/corefx/tags","blobs_url":"https://api.github.com/repos/Drawaes/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Drawaes/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Drawaes/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Drawaes/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Drawaes/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/Drawaes/corefx/languages","stargazers_url":"https://api.github.com/repos/Drawaes/corefx/stargazers","contributors_url":"https://api.github.com/repos/Drawaes/corefx/contributors","subscribers_url":"https://api.github.com/repos/Drawaes/corefx/subscribers","subscription_url":"https://api.github.com/repos/Drawaes/corefx/subscription","commits_url":"https://api.github.com/repos/Drawaes/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Drawaes/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Drawaes/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Drawaes/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Drawaes/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/Drawaes/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Drawaes/corefx/merges","archive_url":"https://api.github.com/repos/Drawaes/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Drawaes/corefx/downloads","issues_url":"https://api.github.com/repos/Drawaes/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/Drawaes/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/Drawaes/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/Drawaes/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Drawaes/corefx/labels{/name}","releases_url":"https://api.github.com/repos/Drawaes/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/Drawaes/corefx/deployments","created_at":"2017-06-29T23:25:42Z","updated_at":"2017-06-29T23:26:22Z","pushed_at":"2017-10-08T11:18:18Z","git_url":"git://github.com/Drawaes/corefx.git","ssh_url":"git@github.com:Drawaes/corefx.git","clone_url":"https://github.com/Drawaes/corefx.git","svn_url":"https://github.com/Drawaes/corefx","homepage":"https://github.com/dotnet/core","size":157867,"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,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"c1539411e4bc053eda9f864ba0a285aecd25e5b3","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2017-10-17T02:52:53Z","pushed_at":"2017-10-17T02:46:29Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"https://github.com/dotnet/core","size":158729,"stargazers_count":12654,"watchers_count":12654,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3531,"mirror_url":null,"open_issues_count":2059,"forks":3531,"open_issues":2059,"watchers":12654,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/24492"},"html":{"href":"https://github.com/dotnet/corefx/pull/24492"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/24492"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/24492/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/24492/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/24492/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/7a132a4d2694413bab5762b7af6ef5606c7b8724"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"stephentoub"}}