diff options
author | Simon Howard | 2011-10-13 22:44:57 +0000 |
---|---|---|
committer | Simon Howard | 2011-10-13 22:44:57 +0000 |
commit | b283ed0be692f0a9d96721013bda361717452665 (patch) | |
tree | 7c84b00579156743f50cf54d564b733040e5245a | |
parent | ba0390ac0a78e28a1f36925a1df891f3682a7b20 (diff) | |
download | chocolate-doom-b283ed0be692f0a9d96721013bda361717452665.tar.gz chocolate-doom-b283ed0be692f0a9d96721013bda361717452665.tar.bz2 chocolate-doom-b283ed0be692f0a9d96721013bda361717452665.zip |
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
-rw-r--r-- | src/net_server.c | 16 |
1 files changed, 16 insertions, 0 deletions
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); |