From 6d2ffb4c637a49983bc6ce22b68ccec0ed09e0f4 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 3 Oct 2009 15:17:16 +0000 Subject: * Merge ioq3-r1637 --- src/server/sv_net_chan.c | 60 +++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'src/server/sv_net_chan.c') diff --git a/src/server/sv_net_chan.c b/src/server/sv_net_chan.c index 0de49d4f..dd2bb204 100644 --- a/src/server/sv_net_chan.c +++ b/src/server/sv_net_chan.c @@ -35,28 +35,29 @@ SV_Netchan_Encode ============== */ static void SV_Netchan_Encode( client_t *client, msg_t *msg ) { - long reliableAcknowledge, i, index; + long i, index; byte key, *string; - int srdc, sbit, soob; - + int srdc, sbit; + qboolean soob; + if ( msg->cursize < SV_ENCODE_START ) { return; } - srdc = msg->readcount; - sbit = msg->bit; - soob = msg->oob; - - msg->bit = 0; - msg->readcount = 0; - msg->oob = 0; - - reliableAcknowledge = MSG_ReadLong(msg); + srdc = msg->readcount; + sbit = msg->bit; + soob = msg->oob; + + msg->bit = 0; + msg->readcount = 0; + msg->oob = qfalse; + + /* reliableAcknowledge = */ MSG_ReadLong(msg); + + msg->oob = soob; + msg->bit = sbit; + msg->readcount = srdc; - msg->oob = soob; - msg->bit = sbit; - msg->readcount = srdc; - string = (byte *)client->lastClientCommandString; index = 0; // xor the client challenge with the netchan sequence number @@ -90,23 +91,24 @@ SV_Netchan_Decode */ static void SV_Netchan_Decode( client_t *client, msg_t *msg ) { int serverId, messageAcknowledge, reliableAcknowledge; - int i, index, srdc, sbit, soob; + int i, index, srdc, sbit; + qboolean soob; byte key, *string; - srdc = msg->readcount; - sbit = msg->bit; - soob = msg->oob; - - msg->oob = 0; - - serverId = MSG_ReadLong(msg); + srdc = msg->readcount; + sbit = msg->bit; + soob = msg->oob; + + msg->oob = qfalse; + + serverId = MSG_ReadLong(msg); messageAcknowledge = MSG_ReadLong(msg); reliableAcknowledge = MSG_ReadLong(msg); - msg->oob = soob; - msg->bit = sbit; - msg->readcount = srdc; - + msg->oob = soob; + msg->bit = sbit; + msg->readcount = srdc; + string = (byte *)client->reliableCommands[ reliableAcknowledge & (MAX_RELIABLE_COMMANDS-1) ]; index = 0; // @@ -137,7 +139,7 @@ void SV_Netchan_TransmitNextFragment( client_t *client ) { if (!client->netchan.unsentFragments) { // make sure the netchan queue has been properly initialized (you never know) - if (!client->netchan_end_queue) { + if ((!client->netchan_end_queue) && (client->state >= CS_CONNECTED)) { Com_Error(ERR_DROP, "netchan queue is not properly initialized in SV_Netchan_TransmitNextFragment\n"); } // the last fragment was transmitted, check wether we have queued messages -- cgit