diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7ed98e40..31f73d78 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1374,8 +1374,6 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.challengenum = cl_challengenum; memcpy(netbuffer->u.clientcfg.challengeanswer, cl_challengeanswer, MD5_LEN); - nodes[servernode].flags &= ~NF_CLOSE; // Hell if I know. - return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); } @@ -3832,9 +3830,6 @@ static void HandleConnect(SINT8 node) } } - // The connecting node may be - nodes[node].flags &= ~NF_CLOSE; - if (netbuffer->u.clientcfg.needsdownload) { netbuffer->packettype = PT_DOWNLOADFILESOKAY; diff --git a/src/d_net.c b/src/d_net.c index 164be502..954e7529 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1110,6 +1110,10 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen netbuffer->checksum = NetbufferChecksum(); sendbytes += packetheaderlength + doomcom->datalength; // For stat + // Joinpasswords close nodes, this may try to send to a waiting-to-close node, so cancel closing? + if (netbuffer->packettype == PT_CLIENTJOIN) + nodes[node].flags &= ~NF_CLOSE; + #ifdef PACKETDROP // Simulate internet :) //if (rand() >= (INT32)(RAND_MAX * (PACKETLOSSRATE / 100.f))) @@ -1191,6 +1195,10 @@ boolean HGetPacket(void) SV_AbortSendFiles(doomcom->remotenode); } + // Joinpasswords close nodes, this may receive from a waiting-to-close node, so cancel closing? + if (netbuffer->packettype == PT_CLIENTJOIN) + nodes[doomcom->remotenode].flags &= ~NF_CLOSE; + getbytes += packetheaderlength + doomcom->datalength; // For stat if (doomcom->remotenode >= MAXNETNODES) diff --git a/src/i_tcp.c b/src/i_tcp.c index ab14cdc9..4989fbd2 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -508,6 +508,8 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask) return false; } +static void SOCK_FreeNodenum(INT32 numnode); + // This is a hack. For some reason, nodes aren't being freed properly. // This goes through and cleans up what nodes were supposed to be freed. /** \warning This function causes the file downloading to stop if someone joins.