Skip to content

Commit

Permalink
Move App/Transport async task to ClientConnection class
Browse files Browse the repository at this point in the history
  • Loading branch information
terencefan committed Oct 16, 2023
1 parent cd929a9 commit 4c8092c
Show file tree
Hide file tree
Showing 7 changed files with 442 additions and 408 deletions.
4 changes: 4 additions & 0 deletions src/Microsoft.Azure.SignalR.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static class Periods
// Custom handshake timeout of SignalR Service
public const int DefaultHandshakeTimeout = 15;
public const int MaxCustomHandshakeTimeout = 30;

public static readonly TimeSpan DefaultServerHandshakeTimeout = TimeSpan.FromSeconds(15);
public static readonly TimeSpan DefaultClientHandshakeTimeout = TimeSpan.FromSeconds(15);
}

public static class ClaimType
Expand Down Expand Up @@ -102,6 +105,7 @@ public static class Headers
public const string AsrsHeaderPrefix = "X-ASRS-";
public const string AsrsServerId = AsrsHeaderPrefix + "Server-Id";
public const string AsrsMessageTracingId = AsrsHeaderPrefix + "Message-Tracing-Id";
public const string AsrsIngressReloadMigrate = AsrsHeaderPrefix + "Ingress-Reload-Migrate";
public const string MicrosoftErrorCode = "x-ms-error-code";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ namespace Microsoft.Azure.SignalR
{
internal abstract class ServiceConnectionBase : IServiceConnection
{
protected static readonly TimeSpan DefaultHandshakeTimeout = TimeSpan.FromSeconds(15);

// Service ping rate is 5 sec to let server know service status. Set timeout for 30 sec for some space.
private static readonly TimeSpan DefaultServiceTimeout = TimeSpan.FromSeconds(30);

Expand Down Expand Up @@ -389,7 +387,7 @@ protected virtual async Task<bool> HandshakeAsync(ConnectionContext context)
using var cts = new CancellationTokenSource();
if (!Debugger.IsAttached)
{
cts.CancelAfter(DefaultHandshakeTimeout);
cts.CancelAfter(Constants.Periods.DefaultServerHandshakeTimeout);
}

if (await ReceiveHandshakeResponseAsync(context.Transport.Input, cts.Token))
Expand Down
Loading

0 comments on commit 4c8092c

Please sign in to comment.