]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
Make connections atomic. Disconnect before trying to connect.
[xonotic/darkplaces.git] / cl_main.c
index 7af224e045bb68c1aa496b123f3eaeefde0771a7..b0c913d054fa1e0092262e219ba89f46c56b8664 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -427,15 +427,13 @@ void CL_EstablishConnection(const char *host, int firstarg)
 #ifdef CONFIG_MENU
        M_Update_Return_Reason("");
 #endif
-       cls.demonum = -1;
-
-       // stop demo loop in case this fails
-       if (cls.demoplayback)
-               CL_StopPlayback();
 
        // if downloads are running, cancel their finishing action
        Curl_Clear_forthismap();
 
+       // Disconnect from the current server, or stop a running demo.
+       CL_Disconnect();
+
        // make sure the client ports are open before attempting to connect
        NetConn_UpdateSockets();