commit b283ed0be692f0a9d96721013bda361717452665
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Oct 13 22:44:57 2011 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Thu Oct 13 22:44:57 2011 +0000
Fix lockup just after startup of single-player multiplayer games. Don't
allow the server to advance too far ahead of the client.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2420
---
src/net_server.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/net_server.c b/src/net_server.c
index 157f5069..24a50bd0 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1294,6 +1294,7 @@ static void NET_SV_PumpSendQueue(net_client_t *client)
{
net_full_ticcmd_t cmd;
int recv_index;
+ int num_players;
int i;
int starttic, endtic;
@@ -1317,6 +1318,8 @@ static void NET_SV_PumpSendQueue(net_client_t *client)
// Check if we can generate a new entry for the send queue
// using the data in recvwindow.
+ num_players = 0;
+
for (i=0; i<MAXPLAYERS; ++i)
{
if (sv_players[i] == client)
@@ -1338,6 +1341,19 @@ static void NET_SV_PumpSendQueue(net_client_t *client)
return;
}
+
+ ++num_players;
+ }
+
+ // If this is a game with only a single player in it, we might
+ // be sending a ticcmd set containing 0 ticcmds. This is fine;
+ // however, there's nothing to stop the game running on ahead
+ // and never stopping. Don't let the server get too far ahead
+ // of the client.
+
+ if (num_players == 0 && client->sendseq > recvwindow_start + 10)
+ {
+ return;
}
//printf("SV: have complete ticcmd for %i\n", client->sendseq);