{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/SignalR/pulls/comments/190758751","pull_request_review_id":123176025,"id":190758751,"diff_hunk":"@@ -2019,6 +2019,75 @@ public int Serialize(ref byte[] bytes, int offset, T value, IFormatterResolver f\n             }\n         }\n \n+        [Fact]\n+        public async Task ConnectionNotTimedOutIfClientNeverPings()\n+        {\n+            var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(services =>\n+                services.Configure<HubOptions>(options =>\n+                   options.ClientTimeoutInterval = TimeSpan.FromMilliseconds(100)));\n+            var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();\n+\n+            using (var client = new TestClient(new JsonHubProtocol()))\n+            {\n+                var connectionHandlerTask = await client.ConnectAsync(connectionHandler);\n+                await client.Connected.OrTimeout();\n+                // This is a fake client -- it doesn't auto-ping to signal\n+\n+                // We go over the 100 ms timeout interval...\n+                await Task.Delay(120);\n+                client.TickHeartbeat();\n+\n+                // but client should still be open, since it never pinged to activate the timeout checking\n+                await Assert.ThrowsAsync<TimeoutException>(() => connectionHandlerTask.OrTimeout(60));\n+            }\n+        }\n+\n+        [Fact]\n+        public async Task ConnectionTimesOutIfInitialPingAndThenNoMessages()\n+        {\n+            var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(services =>\n+                services.Configure<HubOptions>(options =>\n+                    options.ClientTimeoutInterval = TimeSpan.FromMilliseconds(100)));\n+            var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();\n+\n+            using (var client = new TestClient(new JsonHubProtocol()))\n+            {\n+                var connectionHandlerTask = await client.ConnectAsync(connectionHandler);\n+                await client.Connected.OrTimeout();\n+                await client.SendHubMessageAsync(PingMessage.Instance);\n+\n+                await Task.Delay(120);\n+                client.TickHeartbeat();\n+\n+                await connectionHandlerTask.OrTimeout(60);","path":"test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs","position":44,"original_position":44,"commit_id":"6c981c2cfb0398bf68946b88ae8f0c764d08e6e9","original_commit_id":"6c981c2cfb0398bf68946b88ae8f0c764d08e6e9","user":{"login":"JamesNK","id":303201,"avatar_url":"https://avatars2.githubusercontent.com/u/303201?v=4","gravatar_id":"","url":"https://api.github.com/users/JamesNK","html_url":"https://github.com/JamesNK","followers_url":"https://api.github.com/users/JamesNK/followers","following_url":"https://api.github.com/users/JamesNK/following{/other_user}","gists_url":"https://api.github.com/users/JamesNK/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesNK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesNK/subscriptions","organizations_url":"https://api.github.com/users/JamesNK/orgs","repos_url":"https://api.github.com/users/JamesNK/repos","events_url":"https://api.github.com/users/JamesNK/events{/privacy}","received_events_url":"https://api.github.com/users/JamesNK/received_events","type":"User","site_admin":false},"body":"This short a timeout will cause flakiness. I would just use the default timeout unless there is a good reason not to.","created_at":"2018-05-24T23:36:00Z","updated_at":"2018-05-24T23:37:37Z","html_url":"https://github.com/aspnet/SignalR/pull/2364#discussion_r190758751","pull_request_url":"https://api.github.com/repos/aspnet/SignalR/pulls/2364","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/comments/190758751"},"html":{"href":"https://github.com/aspnet/SignalR/pull/2364#discussion_r190758751"},"pull_request":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/2364"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/SignalR/pulls/2364","id":190128070,"html_url":"https://github.com/aspnet/SignalR/pull/2364","diff_url":"https://github.com/aspnet/SignalR/pull/2364.diff","patch_url":"https://github.com/aspnet/SignalR/pull/2364.patch","issue_url":"https://api.github.com/repos/aspnet/SignalR/issues/2364","number":2364,"state":"open","locked":false,"title":"Dygray/ping catcher","user":{"login":"DylanDmitri","id":13950346,"avatar_url":"https://avatars0.githubusercontent.com/u/13950346?v=4","gravatar_id":"","url":"https://api.github.com/users/DylanDmitri","html_url":"https://github.com/DylanDmitri","followers_url":"https://api.github.com/users/DylanDmitri/followers","following_url":"https://api.github.com/users/DylanDmitri/following{/other_user}","gists_url":"https://api.github.com/users/DylanDmitri/gists{/gist_id}","starred_url":"https://api.github.com/users/DylanDmitri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DylanDmitri/subscriptions","organizations_url":"https://api.github.com/users/DylanDmitri/orgs","repos_url":"https://api.github.com/users/DylanDmitri/repos","events_url":"https://api.github.com/users/DylanDmitri/events{/privacy}","received_events_url":"https://api.github.com/users/DylanDmitri/received_events","type":"User","site_admin":false},"body":"Fixes #2289\r\nFixes #2372\r\n\r\nServer catches pings from clients. Silent clients are timed out and disconnected.\r\n\r\nClients auto-ping on startup to signal that it's a pinging client. This first ping is caught in ```DefaultHubDispatcher```, which registers a timeout method to the ```HubConnectionContext``` heartbeat. \r\n\r\nThe timeout window is reset whenever a message is received (per connection, under ```DispatchMessagesAsync``` in ```HubConnectionHandler```).\r\n\r\nOn timeout the connection is closed.\r\n\r\n","created_at":"2018-05-23T23:01:27Z","updated_at":"2018-05-24T23:37:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44042714e4060cf42fd97f5af3491acbce629f7f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"anurse","id":7574,"avatar_url":"https://avatars3.githubusercontent.com/u/7574?v=4","gravatar_id":"","url":"https://api.github.com/users/anurse","html_url":"https://github.com/anurse","followers_url":"https://api.github.com/users/anurse/followers","following_url":"https://api.github.com/users/anurse/following{/other_user}","gists_url":"https://api.github.com/users/anurse/gists{/gist_id}","starred_url":"https://api.github.com/users/anurse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anurse/subscriptions","organizations_url":"https://api.github.com/users/anurse/orgs","repos_url":"https://api.github.com/users/anurse/repos","events_url":"https://api.github.com/users/anurse/events{/privacy}","received_events_url":"https://api.github.com/users/anurse/received_events","type":"User","site_admin":false},{"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}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/SignalR/pulls/2364/commits","review_comments_url":"https://api.github.com/repos/aspnet/SignalR/pulls/2364/comments","review_comment_url":"https://api.github.com/repos/aspnet/SignalR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/SignalR/issues/2364/comments","statuses_url":"https://api.github.com/repos/aspnet/SignalR/statuses/6c981c2cfb0398bf68946b88ae8f0c764d08e6e9","head":{"label":"aspnet:dygray/pingCatcher","ref":"dygray/pingCatcher","sha":"6c981c2cfb0398bf68946b88ae8f0c764d08e6e9","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-05-24T23:33:09Z","pushed_at":"2018-05-24T23:35: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":9277,"stargazers_count":1800,"watchers_count":1800,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":312,"mirror_url":null,"archived":false,"open_issues_count":128,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":312,"open_issues":128,"watchers":1800,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"7b64e41ed913bcb3b1cd33b49ee0a32d2bfa19b7","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-05-24T23:33:09Z","pushed_at":"2018-05-24T23:35: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":9277,"stargazers_count":1800,"watchers_count":1800,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":312,"mirror_url":null,"archived":false,"open_issues_count":128,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":312,"open_issues":128,"watchers":1800,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/2364"},"html":{"href":"https://github.com/aspnet/SignalR/pull/2364"},"issue":{"href":"https://api.github.com/repos/aspnet/SignalR/issues/2364"},"comments":{"href":"https://api.github.com/repos/aspnet/SignalR/issues/2364/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/2364/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/SignalR/pulls/2364/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/SignalR/statuses/6c981c2cfb0398bf68946b88ae8f0c764d08e6e9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"JamesNK"}}