Simplify server tick timeout handling.

This commit is contained in:
Paul Chote
2018-08-11 14:04:49 +01:00
parent d37119655b
commit efccd610d3
3 changed files with 4 additions and 9 deletions

View File

@@ -170,7 +170,6 @@ namespace OpenRA.Server
Log.Write("server", "Initial mod: {0}", ModData.Manifest.Id);
Log.Write("server", "Initial map: {0}", LobbyInfo.GlobalSettings.Map);
var timeout = serverTraits.WithInterface<ITick>().Min(t => t.TickTimeout);
for (;;)
{
var checkRead = new List<Socket>();
@@ -180,7 +179,9 @@ namespace OpenRA.Server
checkRead.AddRange(Conns.Select(c => c.Socket));
checkRead.AddRange(PreConns.Select(c => c.Socket));
var localTimeout = waitingForAuthenticationCallback > 0 ? 100000 : timeout;
// Block for at most 1 second in order to guarantee a minimum tick rate for ServerTraits
// Decrease this to 100ms to improve responsiveness if we are waiting for an authentication query
var localTimeout = waitingForAuthenticationCallback > 0 ? 100000 : 1000000;
if (checkRead.Count > 0)
Socket.Select(checkRead, null, null, localTimeout);

View File

@@ -23,11 +23,7 @@ namespace OpenRA.Server
public interface IStartGame { void GameStarted(Server server); }
public interface IClientJoined { void ClientJoined(Server server, Connection conn); }
public interface IEndGame { void GameEnded(Server server); }
public interface ITick
{
void Tick(Server server);
int TickTimeout { get; }
}
public interface ITick { void Tick(Server server); }
public abstract class ServerTrait { }