mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-31 00:51:17 +00:00
- Improve snapshot rate and data rate control
- Make server send packet fragments and queued packets when server is idle - Voip protocol detection is tied to com_protocol making past-end-of-message reading unncessary - Use Hunk_AllocateTempMemory() for buffering VOIP packets and fix buffering scheme that ryan hates so much - Disable packet scrambling for new protocol as it is useless now - Get rid of the old packet scrambling functions predating latest point release - Use Hunk_AllocateTempMemory() for netchan packet queue to fix memory leak when client gets disconnected with packets in the queue - Use Hunk_AllocateTempMemory() for download blocks to fix memory leak when client gets disconnected with download blocks in the queue - Fix SV_RateMsec to account for udp/udp6 packet lengths
This commit is contained in:
parent
a844c94af1
commit
ac30d86db0
15 changed files with 345 additions and 356 deletions
|
@ -1156,5 +1156,52 @@ void SV_Frame( int msec ) {
|
|||
SV_MasterHeartbeat(sv_heartbeat->string);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
/*
|
||||
====================
|
||||
SV_RateMsec
|
||||
|
||||
Return the number of msec until another message can be sent to
|
||||
a client based on its rate settings
|
||||
====================
|
||||
*/
|
||||
|
||||
#define UDPIP_HEADER_SIZE 28
|
||||
#define UDPIP6_HEADER_SIZE 48
|
||||
|
||||
int SV_RateMsec(client_t *client)
|
||||
{
|
||||
int rate, rateMsec;
|
||||
int messageSize;
|
||||
|
||||
messageSize = client->netchan.lastSentSize;
|
||||
rate = client->rate;
|
||||
|
||||
if(sv_maxRate->integer)
|
||||
{
|
||||
if(sv_maxRate->integer < 1000)
|
||||
Cvar_Set( "sv_MaxRate", "1000" );
|
||||
if(sv_maxRate->integer < rate)
|
||||
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(client->netchan.remoteAddress.type == NA_IP6)
|
||||
messageSize += UDPIP6_HEADER_SIZE;
|
||||
else
|
||||
messageSize += UDPIP_HEADER_SIZE;
|
||||
|
||||
rateMsec = messageSize * 1000 / ((int) (rate * com_timescale->value));
|
||||
rate = Sys_Milliseconds() - client->netchan.lastSentTime;
|
||||
|
||||
if(rate > rateMsec)
|
||||
return 0;
|
||||
else
|
||||
return rateMsec - rate;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue