diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-03 02:32:52 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-06-03 02:32:52 +0000 |
commit | a4f6e2f577d878e4d7b6e27f9e86af3d462f8f77 (patch) | |
tree | a260f5d2e0191570b2e5bad3b2a353fc19c2c158 /code/server | |
parent | 74ccff8bf571b8bfeeea42a4c62ea0528393fa37 (diff) | |
download | ioquake3-aero-a4f6e2f577d878e4d7b6e27f9e86af3d462f8f77.tar.gz ioquake3-aero-a4f6e2f577d878e4d7b6e27f9e86af3d462f8f77.zip |
Changed the protocol for VoIP packets to support legacy clients.
Previously, a legacy client wouldn't get a VoIP packet, but if they did,
they'd panic and disconnect. Now they ignore them and continue on. This also
gives us the framework to add other features legacy clients can ignore.
Oh, this also has the benefit of allowing us to store incoming VoIP for
playback in recorded demos. They'll play the chatter on VoIP clients, and
be ignored on legacy ones. Huge win.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1361 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/server')
-rw-r--r-- | code/server/sv_client.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/code/server/sv_client.c b/code/server/sv_client.c index 2528e64..180bbf3 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -1108,6 +1108,14 @@ void SV_WriteVoipToClient( client_t *cl, msg_t *msg ) if (totalbytes > MAX_DOWNLOAD_BLKSIZE) break; + // You have to start with a svc_EOF, so legacy clients drop the + // rest of this packet. Otherwise, those without VoIP support will + // see the svc_voip command, then panic and disconnect. + // Generally we don't send VoIP packets to legacy clients, but this + // serves as both a safety measure and a means to keep demo files + // compatible. + MSG_WriteByte( msg, svc_EOF ); + MSG_WriteByte( msg, svc_extension ); MSG_WriteByte( msg, svc_voip ); MSG_WriteShort( msg, packet->sender ); MSG_WriteByte( msg, (byte) packet->generation ); @@ -1880,9 +1888,23 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) { // read optional clientCommand strings do { c = MSG_ReadByte( msg ); + + // See if this is an extension command after the EOF, which means we + // got data that a legacy server should ignore. + if ((c == clc_EOF) && (MSG_LookaheadByte( msg ) == clc_extension)) { + MSG_ReadByte( msg ); // throw the clc_extension byte away. + c = MSG_ReadByte( msg ); // something legacy servers can't do! + // sometimes you get a clc_extension at end of stream...dangling + // bits in the huffman decoder giving a bogus value? + if (c == -1) { + c = clc_EOF; + } + } + if ( c == clc_EOF ) { break; } + if ( c != clc_clientCommand ) { break; } @@ -1899,8 +1921,8 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) { SV_UserMove( cl, msg, qtrue ); } else if ( c == clc_moveNoDelta ) { SV_UserMove( cl, msg, qfalse ); -#if USE_VOIP } else if ( c == clc_voip ) { +#if USE_VOIP SV_UserVoip( cl, msg ); #endif } else if ( c != clc_EOF ) { |