From c5e507fb1582a3056a9167425ca847c7188f2ca7 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Mon, 15 Apr 2019 15:19:41 +0100 Subject: [PATCH] ServerList timeout option --- Facepunch.Steamworks/Redux/ServerList/BaseServerList.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Facepunch.Steamworks/Redux/ServerList/BaseServerList.cs b/Facepunch.Steamworks/Redux/ServerList/BaseServerList.cs index d564d7a..213a5ee 100644 --- a/Facepunch.Steamworks/Redux/ServerList/BaseServerList.cs +++ b/Facepunch.Steamworks/Redux/ServerList/BaseServerList.cs @@ -66,8 +66,10 @@ namespace Steamworks /// Query the server list. Task result will be true when finished /// /// - public async Task RunQueryAsync() + public async Task RunQueryAsync( float timeoutSeconds = 10 ) { + var stopwatch = System.Diagnostics.Stopwatch.StartNew(); + Reset(); LaunchQuery(); @@ -92,6 +94,9 @@ namespace Steamworks { OnChanges?.Invoke(); } + + if ( stopwatch.Elapsed.TotalSeconds > timeoutSeconds ) + break; } MovePendingToUnresponsive();