From c40524593d4eebc3b4bde75bb88ebaec2d64e1d3 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sun, 27 Sep 2020 00:14:27 +0000 Subject: [PATCH] cl_main: Disconnect when connection is established, only if we're already connected git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12952 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 3 +-- netconn.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cl_main.c b/cl_main.c index 2f3af19a..fb456b06 100644 --- 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; diff --git a/netconn.c b/netconn.c index f3c64322..234eec60 100755 --- 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; -- 2.39.2