Add a 'Shutting down' state to the gameserver.
Tell the masterserver about it, so it can quickly remove games from the list when they are finished, rather than waiting for the 5 minute TTL to expire.
This commit is contained in:
committed by
Chris Forbes
parent
3a77082c66
commit
0c104cfc3a
@@ -17,7 +17,7 @@ using S = OpenRA.Server.Server;
|
||||
|
||||
namespace OpenRA.Mods.RA.Server
|
||||
{
|
||||
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame
|
||||
public class MasterServerPinger : ServerTrait, ITick, INotifySyncLobbyInfo, IStartGame, IEndGame
|
||||
{
|
||||
const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit
|
||||
// of leeway.
|
||||
@@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
|
||||
public void LobbyInfoSynced(S server) { PingMasterServer(server); }
|
||||
public void GameStarted(S server) { PingMasterServer(server); }
|
||||
public void GameEnded(S server) { PingMasterServer(server); }
|
||||
|
||||
int lastPing = 0;
|
||||
bool isInitialPing = true;
|
||||
@@ -60,10 +61,11 @@ namespace OpenRA.Mods.RA.Server
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
wc.Proxy = null;
|
||||
|
||||
wc.DownloadData(
|
||||
server.Settings.MasterServer + url.F(
|
||||
server.Settings.ExternalPort, Uri.EscapeUriString(server.Settings.Name),
|
||||
server.GameStarted ? 2 : 1, // todo: post-game states, etc.
|
||||
(int) server.State,
|
||||
server.lobbyInfo.Clients.Count,
|
||||
Game.CurrentMods.Select(f => "{0}@{1}".F(f.Key, f.Value.Version)).JoinWith(","),
|
||||
server.lobbyInfo.GlobalSettings.Map,
|
||||
|
||||
Reference in New Issue
Block a user