- Added SV_Shutdown to Linux signal handler to ensure that clients don't hang when server gets killed, as suggested by Tony J. White

- Added newline to final message sent to clients.
- Added check for whether client is running at all before CL_Shutdown runs through.
This commit is contained in:
Thilo Schulz 2006-05-04 13:59:58 +00:00
parent 2583351211
commit 1847c321f0
3 changed files with 6 additions and 1 deletions

View file

@ -2564,6 +2564,10 @@ CL_Shutdown
void CL_Shutdown( void ) { void CL_Shutdown( void ) {
static qboolean recursive = qfalse; static qboolean recursive = qfalse;
// check whether the client is running at all.
if(!(com_cl_running && com_cl_running->integer))
return;
Com_Printf( "----- CL_Shutdown -----\n" ); Com_Printf( "----- CL_Shutdown -----\n" );
if ( recursive ) { if ( recursive ) {

View file

@ -646,7 +646,7 @@ void SV_FinalMessage( char *message ) {
if (cl->state >= CS_CONNECTED) { if (cl->state >= CS_CONNECTED) {
// don't send a disconnect to a local client // don't send a disconnect to a local client
if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) { if ( cl->netchan.remoteAddress.type != NA_LOOPBACK ) {
SV_SendServerCommand( cl, "print \"%s\"\n", message ); SV_SendServerCommand( cl, "print \"%s\n\"\n", message );
SV_SendServerCommand( cl, "disconnect" ); SV_SendServerCommand( cl, "disconnect" );
} }
// force a snapshot to be sent // force a snapshot to be sent

View file

@ -46,6 +46,7 @@ static void signal_handler(int sig) // bk010104 - replace this... (NOTE TTimo hu
// rcg08312005 Agreed: changed to CL_Shutdown... --ryan. // rcg08312005 Agreed: changed to CL_Shutdown... --ryan.
CL_Shutdown(); CL_Shutdown();
#endif #endif
SV_Shutdown("Signal caught");
Sys_Exit(0); // bk010104 - abstraction NOTE TTimo send a 0 to avoid DOUBLE SIGNAL FAULT Sys_Exit(0); // bk010104 - abstraction NOTE TTimo send a 0 to avoid DOUBLE SIGNAL FAULT
} }