ServerList timeout option

This commit is contained in:
Garry Newman 2019-04-15 15:19:41 +01:00
parent 920ea6ce6b
commit c5e507fb15

View File

@ -66,8 +66,10 @@ namespace Steamworks
/// Query the server list. Task result will be true when finished /// Query the server list. Task result will be true when finished
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<bool> RunQueryAsync() public async Task<bool> RunQueryAsync( float timeoutSeconds = 10 )
{ {
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
Reset(); Reset();
LaunchQuery(); LaunchQuery();
@ -92,6 +94,9 @@ namespace Steamworks
{ {
OnChanges?.Invoke(); OnChanges?.Invoke();
} }
if ( stopwatch.Elapsed.TotalSeconds > timeoutSeconds )
break;
} }
MovePendingToUnresponsive(); MovePendingToUnresponsive();