Ping Cleanup (#2530)

Tidied up some comments, to make the ResetPing client behavior easier to understand.

Will ping in debug mode for consistency. If this becomes a problem when debugging, developers can disable the pings manually. It's easier to fix something noisy, than try to diagnose inconsistently missing behavior.
This commit is contained in:
Dylan Dmitri Gray 2018-06-25 17:09:05 -07:00 committed by GitHub
parent c251e1768e
commit e7e2ca50e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -12,7 +12,6 @@ using System.Threading;
using System.Threading.Channels; using System.Threading.Channels;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Client.Internal; using Microsoft.AspNetCore.SignalR.Client.Internal;
using Microsoft.AspNetCore.SignalR.Protocol; using Microsoft.AspNetCore.SignalR.Protocol;
@ -556,6 +555,9 @@ namespace Microsoft.AspNetCore.SignalR.Client
private async Task<(bool close, Exception exception)> ProcessMessagesAsync(HubMessage message, ConnectionState connectionState) private async Task<(bool close, Exception exception)> ProcessMessagesAsync(HubMessage message, ConnectionState connectionState)
{ {
Log.ResettingKeepAliveTimer(_logger);
ResetTimeout();
InvocationRequest irq; InvocationRequest irq;
switch (message) switch (message)
{ {
@ -601,7 +603,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
} }
case PingMessage _: case PingMessage _:
Log.ReceivedPing(_logger); Log.ReceivedPing(_logger);
// Nothing to do on receipt of a ping. // timeout is reset above, on receiving any message
break; break;
default: default:
throw new InvalidOperationException($"Unexpected message type: {message.GetType().FullName}"); throw new InvalidOperationException($"Unexpected message type: {message.GetType().FullName}");
@ -777,9 +779,6 @@ namespace Microsoft.AspNetCore.SignalR.Client
} }
else if (!buffer.IsEmpty) else if (!buffer.IsEmpty)
{ {
Log.ResettingKeepAliveTimer(_logger);
ResetTimeout();
Log.ProcessingMessage(_logger, buffer.Length); Log.ProcessingMessage(_logger, buffer.Length);
var close = false; var close = false;

View File

@ -7,7 +7,6 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Runtime.ExceptionServices;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;