diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/server.h | 1 | ||||
-rw-r--r-- | src/server/sv_client.c | 6 | ||||
-rw-r--r-- | src/server/sv_init.c | 1 | ||||
-rw-r--r-- | src/server/sv_main.c | 1 | ||||
-rw-r--r-- | src/server/sv_snapshot.c | 7 |
5 files changed, 16 insertions, 0 deletions
diff --git a/src/server/server.h b/src/server/server.h index 091d7e7a..fd49da7b 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -239,6 +239,7 @@ extern cvar_t *sv_killserver; extern cvar_t *sv_mapname; extern cvar_t *sv_mapChecksum; extern cvar_t *sv_serverid; +extern cvar_t *sv_minRate; extern cvar_t *sv_maxRate; extern cvar_t *sv_minPing; extern cvar_t *sv_maxPing; diff --git a/src/server/sv_client.c b/src/server/sv_client.c index 6cc9eecd..794f32a8 100644 --- a/src/server/sv_client.c +++ b/src/server/sv_client.c @@ -743,6 +743,12 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg ) rate = sv_maxRate->integer; } } + if ( sv_minRate->integer ) { + if ( sv_minRate->integer < 1000 ) + Cvar_Set( "sv_minRate", "1000" ); + if ( sv_minRate->integer > rate ) + rate = sv_minRate->integer; + } if (!rate) { blockspersnap = 1; diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 22f45729..0099e63f 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -539,6 +539,7 @@ void SV_Init (void) { sv_hostname = Cvar_Get ("sv_hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE ); sv_maxclients = Cvar_Get ("sv_maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH); + sv_minRate = Cvar_Get ("sv_minRate", "0", CVAR_ARCHIVE | CVAR_SERVERINFO ); sv_maxRate = Cvar_Get ("sv_maxRate", "0", CVAR_ARCHIVE | CVAR_SERVERINFO ); sv_minPing = Cvar_Get ("sv_minPing", "0", CVAR_ARCHIVE | CVAR_SERVERINFO ); sv_maxPing = Cvar_Get ("sv_maxPing", "0", CVAR_ARCHIVE | CVAR_SERVERINFO ); diff --git a/src/server/sv_main.c b/src/server/sv_main.c index f4d960d9..c84e5ac3 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -45,6 +45,7 @@ cvar_t *sv_killserver; // menu system can set to 1 to shut server down cvar_t *sv_mapname; cvar_t *sv_mapChecksum; cvar_t *sv_serverid; +cvar_t *sv_minRate; cvar_t *sv_maxRate; cvar_t *sv_minPing; cvar_t *sv_maxPing; diff --git a/src/server/sv_snapshot.c b/src/server/sv_snapshot.c index cd295edf..dd483f17 100644 --- a/src/server/sv_snapshot.c +++ b/src/server/sv_snapshot.c @@ -552,6 +552,13 @@ static int SV_RateMsec( client_t *client, int messageSize ) { rate = sv_maxRate->integer; } } + if ( sv_minRate->integer ) { + if ( sv_minRate->integer < 1000 ) + Cvar_Set( "sv_minRate", "1000" ); + if ( sv_minRate->integer > rate ) + rate = sv_minRate->integer; + } + rateMsec = ( messageSize + HEADER_RATE_BYTES ) * 1000 / rate; return rateMsec; |