diff options
author | Simon Howard | 2006-09-30 10:22:48 +0000 |
---|---|---|
committer | Simon Howard | 2006-09-30 10:22:48 +0000 |
commit | ad0d0d1ccbcba4ff66dc3843d78dd1de90cd1fa3 (patch) | |
tree | e20638799433a7969d9e3f268bb0132fddcea9ba /src | |
parent | ecdd879374fee32f48fe2551873cb4801e39711c (diff) | |
download | chocolate-doom-ad0d0d1ccbcba4ff66dc3843d78dd1de90cd1fa3.tar.gz chocolate-doom-ad0d0d1ccbcba4ff66dc3843d78dd1de90cd1fa3.tar.bz2 chocolate-doom-ad0d0d1ccbcba4ff66dc3843d78dd1de90cd1fa3.zip |
Make the server stop sending if one of the clients stops acknowledging.
Fix check on number of players on connect.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 682
Diffstat (limited to 'src')
-rw-r--r-- | src/net_server.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/net_server.c b/src/net_server.c index af794d02..fb676843 100644 --- a/src/net_server.c +++ b/src/net_server.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_server.c 680 2006-09-29 21:25:13Z fraggle $ +// $Id: net_server.c 682 2006-09-30 10:22:48Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -387,17 +387,13 @@ static int NET_SV_NumClients(void) return count; } +// Find the latest tic which has been acknowledged as received by +// all clients. -// Possibly advance the recv window if all connected clients have -// used the data in the window - -static void NET_SV_AdvanceWindow(void) +static int NET_SV_LatestAcknowledged(void) { - int i; int lowtic = -1; - - // Find the smallest value of client->acknowledged for all connected - // clients + int i; for (i=0; i<MAXNETNODES; ++i) { @@ -410,6 +406,20 @@ static void NET_SV_AdvanceWindow(void) } } + return lowtic; +} + + +// Possibly advance the recv window if all connected clients have +// used the data in the window + +static void NET_SV_AdvanceWindow(void) +{ + int lowtic; + int i; + + lowtic = NET_SV_LatestAcknowledged(); + if (lowtic < 0) { return; @@ -648,7 +658,8 @@ static void NET_SV_ParseSYN(net_packet_t *packet, NET_SV_AssignPlayers(); num_players = NET_SV_NumPlayers(); - if (num_players >= MAXPLAYERS) + if ((!cl_drone && num_players >= MAXPLAYERS) + || NET_SV_NumClients() >= MAXNETNODES) { NET_SV_SendReject(addr, "Server is full!"); return; @@ -1280,6 +1291,16 @@ static void NET_SV_PumpSendQueue(net_client_t *client) int i; int starttic, endtic; + // If a client has not sent any acknowledgments for a while, + // wait until they catch up. + + if (client->sendseq - NET_SV_LatestAcknowledged() > 40) + { + return; + } + + // Work out the index into the receive window + recv_index = client->sendseq - recvwindow_start; if (recv_index < 0 || recv_index >= BACKUPTICS) |