From ad0d0d1ccbcba4ff66dc3843d78dd1de90cd1fa3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 30 Sep 2006 10:22:48 +0000 Subject: 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 --- src/net_server.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src') 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= 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) -- cgit v1.2.3