@@ -34,6 +34,11 @@ namespace OpenRA.Network
|
||||
|
||||
public void ClientQuit( int clientId, int lastClientFrame )
|
||||
{
|
||||
if (lastClientFrame == -1)
|
||||
lastClientFrame = framePackets
|
||||
.Where(x => x.Value.ContainsKey(clientId))
|
||||
.Select(x => x.Key).OrderBy(x => x).LastOrDefault();
|
||||
|
||||
clientQuitTimes[clientId] = lastClientFrame;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace OpenRA.Server
|
||||
public int MostRecentFrame = 0;
|
||||
public const int MaxOrderLength = 131072;
|
||||
|
||||
public int TimeSinceLastResponse { get { return Game.RunTime - lastReceivedTime; } }
|
||||
public bool TimeoutMessageShown = false;
|
||||
int lastReceivedTime = 0;
|
||||
|
||||
/* client data */
|
||||
public int PlayerIndex;
|
||||
|
||||
@@ -69,6 +73,9 @@ namespace OpenRA.Server
|
||||
}
|
||||
}
|
||||
|
||||
lastReceivedTime = Game.RunTime;
|
||||
TimeoutMessageShown = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,7 +108,6 @@ namespace OpenRA.Server
|
||||
ExpectLength = 8;
|
||||
State = ReceiveState.Header;
|
||||
|
||||
server.UpdateInFlightFrames(this);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace OpenRA.Server
|
||||
public List<Connection> PreConns = new List<Connection>();
|
||||
|
||||
TcpListener listener = null;
|
||||
Dictionary<int, List<Connection>> inFlightFrames
|
||||
= new Dictionary<int, List<Connection>>();
|
||||
|
||||
TypeDictionary serverTraits = new TypeDictionary();
|
||||
public Session LobbyInfo;
|
||||
@@ -389,20 +387,6 @@ namespace OpenRA.Server
|
||||
SyncLobbyGlobalSettings();
|
||||
}
|
||||
|
||||
public void UpdateInFlightFrames(Connection conn)
|
||||
{
|
||||
if (conn.Frame == 0)
|
||||
return;
|
||||
|
||||
if (!inFlightFrames.ContainsKey(conn.Frame))
|
||||
inFlightFrames[conn.Frame] = new List<Connection> { conn };
|
||||
else
|
||||
inFlightFrames[conn.Frame].Add(conn);
|
||||
|
||||
if (Conns.All(c => inFlightFrames[conn.Frame].Contains(c)))
|
||||
inFlightFrames.Remove(conn.Frame);
|
||||
}
|
||||
|
||||
void DispatchOrdersToClient(Connection c, int client, int frame, byte[] data)
|
||||
{
|
||||
try
|
||||
@@ -527,6 +511,11 @@ namespace OpenRA.Server
|
||||
}
|
||||
|
||||
public void DropClient(Connection toDrop)
|
||||
{
|
||||
DropClient(toDrop, toDrop.MostRecentFrame);
|
||||
}
|
||||
|
||||
public void DropClient(Connection toDrop, int frame)
|
||||
{
|
||||
if (PreConns.Contains(toDrop))
|
||||
PreConns.Remove(toDrop);
|
||||
@@ -565,7 +554,7 @@ namespace OpenRA.Server
|
||||
}
|
||||
}
|
||||
|
||||
DispatchOrders(toDrop, toDrop.MostRecentFrame, new byte[] { 0xbf });
|
||||
DispatchOrders(toDrop, frame, new byte[] { 0xbf });
|
||||
|
||||
if (!Conns.Any())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user