]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cl_main: Disconnect when connection is established, only if we're already connected
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 Sep 2020 00:14:27 +0000 (00:14 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 Sep 2020 00:14:27 +0000 (00:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12952 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
netconn.c

index 2f3af19a31a5dd7fa267c6209b06b14d7171eff5..fb456b06c4fedc0fbf53b34c03a9fc8d2c476c3e 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -352,7 +352,7 @@ This is also called on Host_Error, so it shouldn't cause any errors
 */
 void CL_Disconnect(void)
 {
-       if (cls.state == ca_dedicated || cls.state != ca_connected || !cls.demoplayback)
+       if (cls.state == ca_dedicated)
                return;
 
        if (Sys_CheckParm("-profilegameonly"))
@@ -535,7 +535,6 @@ void CL_EstablishConnection(const char *address, int firstarg)
        if (LHNETADDRESS_FromString(&cls.connect_address, address, 26000) && (cls.connect_mysocket = NetConn_ChooseClientSocketForAddress(&cls.connect_address)))
        {
                // Disconnect from the current server, or stop a running demo.
-               CL_Disconnect();
                cls.connect_trying = true;
                cls.connect_remainingtries = 3;
                cls.connect_nextsendtime = 0;
index f3c64322e42a5a527aa6383e1b59438ca0214d1e..234eec60a26ccfe05c9dbb4d1654c13b15839487 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1519,6 +1519,8 @@ static void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_
                SV_Shutdown ();
                SV_UnlockThreadMutex();
        }
+       if(cls.state == ca_connected || cls.demoplayback)
+               CL_Disconnect();
        // allocate a net connection to keep track of things
        cls.netcon = NetConn_Open(mysocket, peeraddress);
        crypto = &cls.netcon->crypto;