Alternate variant of ugly probably-bad hack

This commit is contained in:
fickleheart 2019-03-30 23:15:11 -05:00
parent 0911ec79d1
commit b434eabf56

View file

@ -364,10 +364,7 @@ static boolean Processackpak(void)
UINT8 ack = netbuffer->ack; UINT8 ack = netbuffer->ack;
getackpacket++; getackpacket++;
if (cmpack(ack, node->firstacktosend) <= 0 if (cmpack(ack, node->firstacktosend) <= 0)
// UGLY PROBABLY-BAD HACK: If we get PT_CLIENTJOIN, assume this is an in-order packet?
&& netbuffer->packettype != PT_CLIENTJOIN
)
{ {
DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack)); DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack));
duppacket++; duppacket++;
@ -390,10 +387,6 @@ static boolean Processackpak(void)
// Then search for a "hole" in the queue // Then search for a "hole" in the queue
UINT8 nextfirstack = (UINT8)(node->firstacktosend + 1); UINT8 nextfirstack = (UINT8)(node->firstacktosend + 1);
// UGLY PROBABLY-BAD HACK: If we get PT_CLIENTJOIN, assume this is an in-order packet?
if (netbuffer->packettype == PT_CLIENTJOIN)
node->firstacktosend = (UINT8)((ack-1+MAXACKTOSEND) % MAXACKTOSEND);
if (!nextfirstack) if (!nextfirstack)
nextfirstack = 1; nextfirstack = 1;
@ -1214,6 +1207,10 @@ boolean HGetPacket(void)
continue; continue;
} }
// UGLY PROBABLY-BAD HACK: If we get PT_CLIENTJOIN, assume this is an in-order packet?
if (netbuffer->packettype == PT_CLIENTJOIN)
nodes[doomcom->remotenode].firstacktosend = (UINT8)((netbuffer->ack-1+MAXACKTOSEND) % MAXACKTOSEND);
if (netbuffer->ack > 1 && !(server && netbuffer->packettype == PT_CLIENTJOIN)) if (netbuffer->ack > 1 && !(server && netbuffer->packettype == PT_CLIENTJOIN))
{ {
DEBFILE("New node sent a packet with an out-of-sequence ack. Ghost connection? Ignoring...\n"); DEBFILE("New node sent a packet with an out-of-sequence ack. Ghost connection? Ignoring...\n");