From 2bf2118d79994cfd805c3ffb5b421c6a65658b84 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Wed, 13 Jul 2011 17:11:30 +0000 Subject: - 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 --- src/server/server.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/server/server.h') diff --git a/src/server/server.h b/src/server/server.h index 1434a87f..7887a2c3 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -35,6 +35,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_ENT_CLUSTERS 16 #ifdef USE_VOIP +#define VOIP_QUEUE_LENGTH 64 + typedef struct voipServerPacket_s { int generation; @@ -170,7 +172,7 @@ typedef struct client_s { int nextReliableTime; // svs.time when another reliable command will be allowed int lastPacketTime; // svs.time when packet was last received int lastConnectTime; // svs.time when connection started - int nextSnapshotTime; // send another snapshot when svs.time >= nextSnapshotTime + int lastSnapshotTime; // svs.time of last sent snapshot qboolean rateDelayed; // true if nextSnapshotTime was set based on rate instead of snapshotMsec int timeoutCount; // must timeout a few frames in a row so debugging doesn't break clientSnapshot_t frames[PACKET_BACKUP]; // updates can be delta'd from here @@ -191,8 +193,9 @@ typedef struct client_s { qboolean hasVoip; qboolean muteAllVoip; qboolean ignoreVoipFromClient[MAX_CLIENTS]; - voipServerPacket_t voipPacket[64]; // !!! FIXME: WAY too much memory! + voipServerPacket_t *voipPacket[VOIP_QUEUE_LENGTH]; int queuedVoipPackets; + int queuedVoipIndex; #endif int oldServerTime; @@ -297,6 +300,7 @@ void SV_RemoveOperatorCommands (void); void SV_MasterShutdown (void); void SV_MasterGameStat( const char *data ); +int SV_RateMsec(client_t *client); @@ -425,6 +429,6 @@ void SV_ClipToEntity( trace_t *trace, const vec3_t start, const vec3_t mins, con // sv_net_chan.c // void SV_Netchan_Transmit( client_t *client, msg_t *msg); -void SV_Netchan_TransmitNextFragment( client_t *client ); +int SV_Netchan_TransmitNextFragment(client_t *client); qboolean SV_Netchan_Process( client_t *client, msg_t *msg ); -- cgit