Skip to content

Commit

Permalink
- Added SV_Shutdown to Linux signal handler to ensure that clients do…
Browse files Browse the repository at this point in the history
…n'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.
  • Loading branch information
Thilo Schulz committed May 4, 2006
1 parent 2583351 commit 1847c32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions code/client/cl_main.c
Expand Up @@ -2564,6 +2564,10 @@ CL_Shutdown
void CL_Shutdown( void ) {
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" );

if ( recursive ) {
Expand Down
2 changes: 1 addition & 1 deletion code/server/sv_init.c
Expand Up @@ -646,7 +646,7 @@ void SV_FinalMessage( char *message ) {
if (cl->state >= CS_CONNECTED) {
// don't send a disconnect to a local client
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" );
}
// force a snapshot to be sent
Expand Down
1 change: 1 addition & 0 deletions code/unix/linux_signals.c
Expand Up @@ -46,6 +46,7 @@ static void signal_handler(int sig) // bk010104 - replace this... (NOTE TTimo hu
// rcg08312005 Agreed: changed to CL_Shutdown... --ryan.
CL_Shutdown();
#endif
SV_Shutdown("Signal caught");
Sys_Exit(0); // bk010104 - abstraction NOTE TTimo send a 0 to avoid DOUBLE SIGNAL FAULT
}

Expand Down

0 comments on commit 1847c32

Please sign in to comment.