Skip to content

Commit

Permalink
Put all servers that failed to respond to the query into a "Unqueried…
Browse files Browse the repository at this point in the history
…" list intead of "Unresponsive"
  • Loading branch information
Jake-Rich committed Sep 7, 2023
1 parent 4463739 commit f8960c8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
21 changes: 21 additions & 0 deletions Facepunch.Steamworks.Test/ServerlistTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,27 @@ public async Task ServerListInternet()
}
}

// Used to reproduce steam serverlist stopping querying after ~10s around august 2023
[TestMethod]
public async Task RustServerListTest()
{
using ( var list = new ServerList.Internet() )
{
list.AddFilter( "secure", "1" );
list.AddFilter( "and", "1" );
list.AddFilter( "gametype", "v2405" );
list.AddFilter( "appid", "252490" );
list.AddFilter( "gamedir", "rust" );
list.AddFilter( "empty", "1" );

var success = await list.RunQueryAsync( 90 );

Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}

[TestMethod]
public async Task SourceQuery()
{
Expand Down
9 changes: 6 additions & 3 deletions Facepunch.Steamworks/ServerList/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public abstract class Base : IDisposable
/// </summary>
public List<ServerInfo> Unresponsive = new List<ServerInfo>();

public List<ServerInfo> Unqueried = new List<ServerInfo>();

public Base()
{
Expand Down Expand Up @@ -176,8 +177,10 @@ void MovePendingToUnresponsive()
{
watchList.RemoveAll( x =>
{
var info = Internal.GetServerDetails( request, x );
OnServer( ServerInfo.From( info ), info.HadSuccessfulResponse );
var details = Internal.GetServerDetails( request, x );
var info = ServerInfo.From( details );
info.Ping = int.MaxValue;
Unqueried.Add( info );
return true;
} );
}
Expand All @@ -194,4 +197,4 @@ private void OnServer( ServerInfo serverInfo, bool responded )
Unresponsive.Add( serverInfo );
}
}
}
}

0 comments on commit f8960c8

Please sign in to comment.