From 3e1570c59d2a3a9baad1f8b38ad8397c37f6ef97 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 22:17:16 -0600 Subject: [PATCH 1/3] Revert "Move HandleConnect to the same place as other packets" This reverts commit 6bba2f16c0c0c8dd657629e829760ecf75ce37a4. --- src/d_clisrv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 08788613..6734b544 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3944,10 +3944,6 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; - case PT_CLIENTJOIN: - if (server) - HandleConnect(node); - break; case PT_JOINCHALLENGE: if (server && serverrunning) { // But wait I thought I'm the server? @@ -4663,6 +4659,12 @@ FILESTAMP while (HGetPacket()) { node = (SINT8)doomcom->remotenode; + + if (netbuffer->packettype == PT_CLIENTJOIN && server) + { + HandleConnect(node); + continue; + } if (node == servernode && client && cl_mode != CL_SEARCHING) { if (netbuffer->packettype == PT_SERVERSHUTDOWN) From 386360ff43ba83d84e87d47010a79500dffbceb7 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 23:36:11 -0600 Subject: [PATCH 2/3] Properly close and reopen the client connection for password challenges --- src/d_clisrv.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6734b544..b05babd6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1909,7 +1909,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) /** Called by CL_ServerConnectionTicker * * \param viams ??? - * \param asksent ??? + * \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit. * \return False if the connection was aborted * \sa CL_ServerConnectionTicker * \sa CL_ConnectToServer @@ -2037,7 +2037,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) * \param viams ??? * \param tmpsave The name of the gamestate file??? * \param oldtic Used for knowing when to poll events and redraw - * \param asksent ??? + * \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit. * \return False if the connection was aborted * \sa CL_ServerConnectionSearchTicker * \sa CL_ConnectToServer @@ -2109,6 +2109,9 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #endif case CL_CHALLENGE: + (*asksent) = I_GetTime() - NEWTICRATE + 2; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... + break; + case CL_WAITJOINRESPONSE: case CL_WAITDOWNLOADFILESRESPONSE: case CL_CONNECTED: @@ -2226,10 +2229,26 @@ boolean CL_Responder(event_t *ev) } else if (ch == KEY_ENTER) { - // Done? - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_mode = cl_needsdownload ? CL_ASKDOWNLOADFILES : CL_ASKJOIN; - cl_challengeattempted = 1; + // Done? Try to reconnect to the server... + if (!netgame && I_NetOpenSocket) + { + MSCloseUDPSocket(); // Tidy up before wiping the slate. + if (I_NetOpenSocket()) + { + netgame = true; + multiplayer = true; + +#ifndef NONET + SL_ClearServerList(servernode); +#endif + cl_mode = CL_SEARCHING; + + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_challengeattempted = 1; + } + } + else + I_Error("haha that ain't it"); } return true; @@ -3956,6 +3975,8 @@ static void HandlePacketFromAwayNode(SINT8 node) cl_challengenum = netbuffer->u.joinchallenge.challengenum; memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); + D_CloseConnection(); // Don't need to stay connected while challenging + cl_mode = CL_CHALLENGE; if (cl_challengeattempted == 2) From ce8150441035056f36b391e65ff6a128da285134 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 23:56:13 -0600 Subject: [PATCH 3/3] Try a partial disconnect instead --- src/d_clisrv.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b05babd6..170c9645 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2109,7 +2109,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #endif case CL_CHALLENGE: - (*asksent) = I_GetTime() - NEWTICRATE + 2; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... + (*asksent) = I_GetTime() - NEWTICRATE; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... break; case CL_WAITJOINRESPONSE: @@ -2229,26 +2229,16 @@ boolean CL_Responder(event_t *ev) } else if (ch == KEY_ENTER) { - // Done? Try to reconnect to the server... - if (!netgame && I_NetOpenSocket) - { - MSCloseUDPSocket(); // Tidy up before wiping the slate. - if (I_NetOpenSocket()) - { - netgame = true; - multiplayer = true; + netgame = true; + multiplayer = true; #ifndef NONET - SL_ClearServerList(servernode); + SL_ClearServerList(servernode); #endif - cl_mode = CL_SEARCHING; + cl_mode = CL_SEARCHING; - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_challengeattempted = 1; - } - } - else - I_Error("haha that ain't it"); + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_challengeattempted = 1; } return true; @@ -3975,7 +3965,7 @@ static void HandlePacketFromAwayNode(SINT8 node) cl_challengenum = netbuffer->u.joinchallenge.challengenum; memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); - D_CloseConnection(); // Don't need to stay connected while challenging + Net_CloseConnection(node|FORCECLOSE); // Don't need to stay connected while challenging cl_mode = CL_CHALLENGE;