fixed waiting for a snapshot forever when the server disconnects during client connection

This commit is contained in:
myT 2018-01-25 04:36:13 +01:00
parent 3e3c1b2431
commit 543a024917
2 changed files with 17 additions and 0 deletions

View file

@ -12,6 +12,8 @@ chg: on Windows, a fatal error will move the early console window to the foregro
chg: com_hunkMegs doesn't have a maximum value anymore
a value too high would reset it and the engine might fail to load with the default value
fix: getting stuck on "Awaiting snapshot..." when the server shuts down during client connection
fix: demo playback would crash when delta entities/players had an invalid field count
fix: strcpy calls with overlapping buffers (undefined behavior), which were responsible for the

View file

@ -576,6 +576,21 @@ static void CL_ParseCommandString( msg_t* msg )
int index = seq & (MAX_RELIABLE_COMMANDS-1);
Q_strncpyz( clc.serverCommands[ index ], s, sizeof( clc.serverCommands[ index ] ) );
// We normally don't process commands before being CA_ACTIVE,
// but it's possible we receive a "disconnect" command while
// still being CA_PRIMED.
// Therefore, we have to make an exception for "disconnect" right here
// to avoid waiting for a snapshot forever.
if ( cls.state == CA_PRIMED ) {
Cmd_TokenizeString(s);
if ( !Q_stricmp( Cmd_Argv(0), "disconnect" ) ) {
if ( Cmd_Argc() >= 2 )
Com_Error( ERR_DROP, "Server disconnected: %s", Cmd_Argv(1) );
else
Com_Error( ERR_DROP, "Server disconnected" );
}
}
}