- 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
|
@ -840,8 +840,6 @@ void CL_WritePacket( void ) {
|
|||
cl_voipSendTarget->modified = qfalse;
|
||||
}
|
||||
|
||||
MSG_WriteByte (&buf, clc_EOF); // placate legacy servers.
|
||||
MSG_WriteByte (&buf, clc_extension);
|
||||
MSG_WriteByte (&buf, clc_voip);
|
||||
MSG_WriteByte (&buf, clc.voipOutgoingGeneration);
|
||||
MSG_WriteLong (&buf, clc.voipOutgoingSequence);
|
||||
|
@ -863,8 +861,6 @@ void CL_WritePacket( void ) {
|
|||
MSG_Init (&fakemsg, fakedata, sizeof (fakedata));
|
||||
MSG_Bitstream (&fakemsg);
|
||||
MSG_WriteLong (&fakemsg, clc.reliableAcknowledge);
|
||||
MSG_WriteByte (&fakemsg, svc_EOF);
|
||||
MSG_WriteByte (&fakemsg, svc_extension);
|
||||
MSG_WriteByte (&fakemsg, svc_voip);
|
||||
MSG_WriteShort (&fakemsg, clc.clientNum);
|
||||
MSG_WriteByte (&fakemsg, clc.voipOutgoingGeneration);
|
||||
|
@ -928,16 +924,6 @@ void CL_WritePacket( void ) {
|
|||
}
|
||||
|
||||
CL_Netchan_Transmit (&clc.netchan, &buf);
|
||||
|
||||
// clients never really should have messages large enough
|
||||
// to fragment, but in case they do, fire them all off
|
||||
// at once
|
||||
// TTimo: this causes a packet burst, which is bad karma for winsock
|
||||
// added a WARNING message, we'll see if there are legit situations where this happens
|
||||
while ( clc.netchan.unsentFragments ) {
|
||||
Com_DPrintf( "WARNING: #462 unsent fragments (not supposed to happen!)\n" );
|
||||
CL_Netchan_TransmitNextFragment( &clc.netchan );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -235,7 +235,7 @@ void CL_Voip_f( void )
|
|||
reason = "Not connected to a server";
|
||||
else if (!clc.speexInitialized)
|
||||
reason = "Speex not initialized";
|
||||
else if (!cl_connectedToVoipServer)
|
||||
else if (!clc.voipEnabled)
|
||||
reason = "Server doesn't support VoIP";
|
||||
else if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
|
||||
reason = "running in single-player mode";
|
||||
|
@ -331,7 +331,7 @@ void CL_CaptureVoip(void)
|
|||
qboolean dontCapture = qfalse;
|
||||
if (clc.state != CA_ACTIVE)
|
||||
dontCapture = qtrue; // not connected to a server.
|
||||
else if (!cl_connectedToVoipServer)
|
||||
else if (!clc.voipEnabled)
|
||||
dontCapture = qtrue; // server doesn't support VoIP.
|
||||
else if (clc.demoplaying)
|
||||
dontCapture = qtrue; // playing back a demo.
|
||||
|
@ -1375,7 +1375,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
|
|||
|
||||
#ifdef USE_VOIP
|
||||
// not connected to voip server anymore.
|
||||
cl_connectedToVoipServer = qfalse;
|
||||
clc.voipEnabled = qfalse;
|
||||
#endif
|
||||
|
||||
// Stop recording any video
|
||||
|
@ -4397,7 +4397,7 @@ void CL_ShowIP_f(void) {
|
|||
|
||||
/*
|
||||
=================
|
||||
bool CL_CDKeyValidate
|
||||
CL_CDKeyValidate
|
||||
=================
|
||||
*/
|
||||
qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "../qcommon/qcommon.h"
|
||||
#include "client.h"
|
||||
|
||||
#ifdef LEGACY_PROTOCOL
|
||||
/*
|
||||
==============
|
||||
CL_Netchan_Encode
|
||||
|
@ -125,14 +126,22 @@ static void CL_Netchan_Decode( msg_t *msg ) {
|
|||
*(msg->data + i) = *(msg->data + i) ^ key;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_Netchan_TransmitNextFragment
|
||||
=================
|
||||
*/
|
||||
void CL_Netchan_TransmitNextFragment( netchan_t *chan ) {
|
||||
Netchan_TransmitNextFragment( chan );
|
||||
qboolean CL_Netchan_TransmitNextFragment(netchan_t *chan)
|
||||
{
|
||||
if(chan->unsentFragments)
|
||||
{
|
||||
Netchan_TransmitNextFragment(chan);
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -143,8 +152,18 @@ CL_Netchan_Transmit
|
|||
void CL_Netchan_Transmit( netchan_t *chan, msg_t* msg ) {
|
||||
MSG_WriteByte( msg, clc_EOF );
|
||||
|
||||
CL_Netchan_Encode( msg );
|
||||
Netchan_Transmit( chan, msg->cursize, msg->data );
|
||||
#ifdef LEGACY_PROTOCOL
|
||||
if(chan->compat)
|
||||
CL_Netchan_Encode(msg);
|
||||
#endif
|
||||
|
||||
Netchan_Transmit(chan, msg->cursize, msg->data);
|
||||
|
||||
// Transmit all fragments without delay
|
||||
while(CL_Netchan_TransmitNextFragment(chan))
|
||||
{
|
||||
Com_DPrintf("WARNING: #462 unsent fragments (not supposed to happen!)\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -159,7 +178,10 @@ qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg ) {
|
|||
if (!ret)
|
||||
return qfalse;
|
||||
|
||||
CL_Netchan_Decode( msg );
|
||||
#ifdef LEGACY_PROTOCOL
|
||||
if(chan->compat)
|
||||
CL_Netchan_Decode(msg);
|
||||
#endif
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ char *svc_strings[256] = {
|
|||
"svc_download",
|
||||
"svc_snapshot",
|
||||
"svc_EOF",
|
||||
"svc_extension",
|
||||
"svc_voip",
|
||||
};
|
||||
|
||||
|
@ -330,10 +329,6 @@ void CL_ParseSnapshot( msg_t *msg ) {
|
|||
int cl_connectedToPureServer;
|
||||
int cl_connectedToCheatServer;
|
||||
|
||||
#ifdef USE_VOIP
|
||||
int cl_connectedToVoipServer;
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SystemInfoChanged
|
||||
|
@ -363,14 +358,18 @@ void CL_SystemInfoChanged( void ) {
|
|||
}
|
||||
|
||||
#ifdef USE_VOIP
|
||||
// in the future, (val) will be a protocol version string, so only
|
||||
// accept explicitly 1, not generally non-zero.
|
||||
s = Info_ValueForKey( systemInfo, "sv_voip" );
|
||||
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
|
||||
cl_connectedToVoipServer = qfalse;
|
||||
#ifdef LEGACY_PROTOCOL
|
||||
if(clc.compat)
|
||||
clc.voipEnabled = qfalse;
|
||||
else
|
||||
cl_connectedToVoipServer = (atoi( s ) == 1);
|
||||
|
||||
#endif
|
||||
{
|
||||
s = Info_ValueForKey( systemInfo, "sv_voip" );
|
||||
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive"))
|
||||
clc.voipEnabled = qfalse;
|
||||
else
|
||||
clc.voipEnabled = atoi(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
s = Info_ValueForKey( systemInfo, "sv_cheats" );
|
||||
|
@ -865,19 +864,6 @@ void CL_ParseServerMessage( msg_t *msg ) {
|
|||
|
||||
cmd = MSG_ReadByte( msg );
|
||||
|
||||
// See if this is an extension command after the EOF, which means we
|
||||
// got data that a legacy client should ignore.
|
||||
if ((cmd == svc_EOF) && (MSG_LookaheadByte( msg ) == svc_extension)) {
|
||||
SHOWNET( msg, "EXTENSION" );
|
||||
MSG_ReadByte( msg ); // throw the svc_extension byte away.
|
||||
cmd = MSG_ReadByte( msg ); // something legacy clients can't do!
|
||||
// sometimes you get a svc_extension at end of stream...dangling
|
||||
// bits in the huffman decoder giving a bogus value?
|
||||
if (cmd == -1) {
|
||||
cmd = svc_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == svc_EOF) {
|
||||
SHOWNET( msg, "END OF MESSAGE" );
|
||||
break;
|
||||
|
|
|
@ -362,7 +362,7 @@ void SCR_DrawVoipMeter( void ) {
|
|||
return; // not recording at the moment.
|
||||
else if (clc.state != CA_ACTIVE)
|
||||
return; // not connected to a server.
|
||||
else if (!cl_connectedToVoipServer)
|
||||
else if (!clc.voipEnabled)
|
||||
return; // server doesn't support VoIP.
|
||||
else if (clc.demoplaying)
|
||||
return; // playing back a demo.
|
||||
|
|
|
@ -234,6 +234,7 @@ typedef struct {
|
|||
unsigned char timeDemoDurations[ MAX_TIMEDEMO_DURATIONS ]; // log of frame durations
|
||||
|
||||
#ifdef USE_VOIP
|
||||
qboolean voipEnabled;
|
||||
qboolean speexInitialized;
|
||||
int speexFrameSize;
|
||||
int speexSampleRate;
|
||||
|
@ -517,7 +518,6 @@ extern int cl_connectedToPureServer;
|
|||
extern int cl_connectedToCheatServer;
|
||||
|
||||
#ifdef USE_VOIP
|
||||
extern int cl_connectedToVoipServer;
|
||||
void CL_Voip_f( void );
|
||||
#endif
|
||||
|
||||
|
@ -622,7 +622,6 @@ void LAN_SaveServersToCache( void );
|
|||
// cl_net_chan.c
|
||||
//
|
||||
void CL_Netchan_Transmit( netchan_t *chan, msg_t* msg); //int length, const byte *data );
|
||||
void CL_Netchan_TransmitNextFragment( netchan_t *chan );
|
||||
qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg );
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue