]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed very annoying '5 second timeout' bug in Host_ShutdownServer (the local client...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Apr 2004 06:20:23 +0000 (06:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Apr 2004 06:20:23 +0000 (06:20 +0000)
added Host_ShutdownServer call near every CL_Disconnect call, for consistency
CL_Disconnect and Host_ShutdownServer now report their calls as dprints (previously they were entirely silent)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4081 d7cf8633-e32d-0410-b094-e92efae38249

cl_demo.c
cl_input.c
cl_main.c
host.c
host_cmd.c
netconn.c

index 1024cf3a9e1266f4027cc8e6eb1255d5af4171e6..85efe355531da7633771881f5178b64fa08bcdb7 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -319,6 +319,7 @@ void CL_PlayDemo_f (void)
 
        // disconnect from server
        CL_Disconnect ();
+       Host_ShutdownServer (false);
 
        // update networking ports (this is mainly just needed at startup)
        NetConn_ClientFrame();
index fac600f92125eae8aeea7a65c3d4d0b6de6da197..e3d964d8a357ae61b40a62dda0a10ffbdaafc759 100644 (file)
@@ -465,6 +465,7 @@ void CL_SendMove(usercmd_t *cmd)
        {
                Con_Print("CL_SendMove: lost server connection\n");
                CL_Disconnect();
+               Host_ShutdownServer(false);
        }
 }
 
index b861dc3be1709a31112cf8e1026b68d277f324a0..511aa1be86b1e65d0b70bfdcd88a2519739e26a4 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -159,6 +159,8 @@ void CL_Disconnect(void)
        if (cls.state == ca_dedicated)
                return;
 
+       Con_DPrintf("CL_Disconnect\n");
+
 // stop sounds (especially looping!)
        S_StopAllSounds (true);
 
@@ -184,13 +186,6 @@ void CL_Disconnect(void)
                SZ_Clear(&cls.message);
                NetConn_Close(cls.netcon);
                cls.netcon = NULL;
-               // if running a local server, shut it down
-               if (sv.active)
-               {
-                       // prevent this code from executing again during Host_ShutdownServer
-                       cls.state = ca_disconnected;
-                       Host_ShutdownServer(false);
-               }
        }
        cls.state = ca_disconnected;
 
diff --git a/host.c b/host.c
index 61c9bb0b05502c65d42cd7a612f1b2bb95805f90..4aea3260bc5a80423a1fbadcf67aadcd4c0f3f84 100644 (file)
--- a/host.c
+++ b/host.c
@@ -111,8 +111,7 @@ void Host_EndGame (const char *format, ...)
        va_end (argptr);
        Con_DPrintf("Host_EndGame: %s\n",string);
 
-       if (sv.active)
-               Host_ShutdownServer (false);
+       Host_ShutdownServer (false);
 
        if (cls.state == ca_dedicated)
                Sys_Error ("Host_EndGame: %s\n",string);        // dedicated servers exit
@@ -168,8 +167,7 @@ void Host_Error (const char *error, ...)
 
        PRVM_ProcessError();
 
-       if (sv.active)
-               Host_ShutdownServer (false);
+       Host_ShutdownServer (false);
 
        if (cls.state == ca_dedicated)
                Sys_Error ("Host_Error: %s\n",hosterrorstring2);        // dedicated servers exit
@@ -507,14 +505,11 @@ void Host_ShutdownServer(qboolean crash)
        if (!sv.active)
                return;
 
+       Con_DPrintf("Host_ShutdownServer\n");
+
        // print out where the crash happened, if it was caused by QC
        PR_Crash();
 
-       sv.active = false;
-
-// stop all client sounds immediately
-       CL_Disconnect();
-
        NetConn_Heartbeat(2);
        NetConn_Heartbeat(2);
 
@@ -533,6 +528,8 @@ void Host_ShutdownServer(qboolean crash)
 
        NetConn_CloseServerPorts();
 
+       sv.active = false;
+
 //
 // clear structures
 //
index 0552aff84d85d3d324f612f41c3e28ad4216ef24..b5d43ffec2299ac62a1776f9cc75b5b727454409 100644 (file)
@@ -1673,6 +1673,7 @@ void Host_Stopdemo_f (void)
        if (!cls.demoplayback)
                return;
        CL_Disconnect ();
+       Host_ShutdownServer (false);
 }
 
 static void MaxPlayers_f(void)
index 3226f763b34c529ae022a43aa35a641d44ea6773..3980258215ef1a75cb8dca0c3354488207946431 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -986,6 +986,7 @@ void NetConn_ClientFrame(void)
        {
                Con_Print("Connection timed out\n");
                CL_Disconnect();
+               Host_ShutdownServer (false);
        }
        for (conn = netconn_list;conn;conn = conn->next)
                NetConn_ReSendMessage(conn);