From 4acf5936c5fce267f1f0551b97135cd562482e0f Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Tue, 21 Jul 2026 18:01:34 -0500 Subject: [PATCH] Add shorter timeout for server notifications --- LANCommander.SDK/Clients/GameClient.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/LANCommander.SDK/Clients/GameClient.cs b/LANCommander.SDK/Clients/GameClient.cs index ba4a507e..dcc52f5e 100644 --- a/LANCommander.SDK/Clients/GameClient.cs +++ b/LANCommander.SDK/Clients/GameClient.cs @@ -91,6 +91,8 @@ namespace LANCommander.SDK.Services private const string PlayerAliasFilename = "PlayerAlias"; private const string KeyFilename = "Key"; + private static readonly TimeSpan ServerNotificationTimeout = TimeSpan.FromSeconds(15); + private TrackableStream _transferStream; private IAsyncReader _reader; @@ -519,6 +521,8 @@ namespace LANCommander.SDK.Services logger?.LogTrace("Signaling to the server that we started the game..."); + using var timeout = new CancellationTokenSource(ServerNotificationTimeout); + try { await apiRequestFactory @@ -526,6 +530,7 @@ namespace LANCommander.SDK.Services .UseAuthenticationToken() .UseVersioning() .UseRoute($"/api/Games/{id}/Started") + .UseCancellationToken(timeout.Token) .GetAsync(); } catch (Exception ex) @@ -541,13 +546,16 @@ namespace LANCommander.SDK.Services logger?.LogTrace("Signaling to the server that we stopped the game..."); + using var timeout = new CancellationTokenSource(ServerNotificationTimeout); + try - { + { await apiRequestFactory .Create() .UseAuthenticationToken() .UseVersioning() .UseRoute($"/api/Games/{id}/Stopped") + .UseCancellationToken(timeout.Token) .GetAsync(); } catch (Exception ex)