mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 12:21:19 +00:00
Revert basically every attempted join passwords fix
This commit is contained in:
parent
b3247b48a1
commit
fcea81e018
3 changed files with 24 additions and 118 deletions
|
@ -674,7 +674,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
static void resynch_read_player(resynch_pak *rsp)
|
static void resynch_read_player(resynch_pak *rsp)
|
||||||
{
|
{
|
||||||
INT32 i = rsp->playernum, j;
|
INT32 i = rsp->playernum, j;
|
||||||
//mobj_t *savedmo = players[i].mo;
|
mobj_t *savedmo = players[i].mo;
|
||||||
|
|
||||||
// Do not send anything visual related.
|
// Do not send anything visual related.
|
||||||
// Only send data that we need to know for physics.
|
// Only send data that we need to know for physics.
|
||||||
|
@ -767,17 +767,11 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//...but keep old mo even if it is corrupt or null!
|
//...but keep old mo even if it is corrupt or null!
|
||||||
//players[i].mo = savedmo;
|
players[i].mo = savedmo;
|
||||||
|
|
||||||
//Transfer important mo information if they have a valid mo.
|
//Transfer important mo information if they have a valid mo.
|
||||||
if (!rsp->hasmo)
|
if (!rsp->hasmo)
|
||||||
{
|
|
||||||
// Get rid of their object if they aren't supposed to have one.....??
|
|
||||||
if (players[i].mo)
|
|
||||||
P_RemoveMobj(players[i].mo);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//server thinks player has a body.
|
//server thinks player has a body.
|
||||||
//Give them a new body that can be then manipulated by the server's info.
|
//Give them a new body that can be then manipulated by the server's info.
|
||||||
|
@ -1030,7 +1024,6 @@ static void SV_SendResynch(INT32 node)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resynch_inprogress[node] = false; // Let's see if there's REALLY anyone left to sync.....
|
|
||||||
netbuffer->packettype = PT_RESYNCHING;
|
netbuffer->packettype = PT_RESYNCHING;
|
||||||
for (i = 0, j = 0; i < MAXPLAYERS; ++i)
|
for (i = 0, j = 0; i < MAXPLAYERS; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1038,24 +1031,10 @@ static void SV_SendResynch(INT32 node)
|
||||||
if (!(resynch_status[node] & 1<<i))
|
if (!(resynch_status[node] & 1<<i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!playeringame[i])
|
|
||||||
continue; // Player doesn't exist any more, so no need to resync them!
|
|
||||||
|
|
||||||
resynch_inprogress[node] = true;
|
|
||||||
|
|
||||||
// waiting for a reply or just waiting in general
|
// waiting for a reply or just waiting in general
|
||||||
if (resynch_sent[node][i])
|
if (resynch_sent[node][i])
|
||||||
{
|
{
|
||||||
--resynch_sent[node][i];
|
--resynch_sent[node][i];
|
||||||
|
|
||||||
if (resynch_sent[node][i] > TICRATE)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_ERROR, "Node %d (%s) somehow had a stupidly-long resync delay?! (%d tics to resync player %d)\n",
|
|
||||||
node, player_names[nodetoplayer[node]], resynch_sent[node][i], i
|
|
||||||
);
|
|
||||||
resynch_sent[node][i] = TICRATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,15 +1048,6 @@ static void SV_SendResynch(INT32 node)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resynch_inprogress[node])
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_ERROR, "Node %d (%s) somehow had resync status for nonexistent players?! (%08x)\n",
|
|
||||||
node, player_names[nodetoplayer[node]], resynch_status[node] = 0x00
|
|
||||||
);
|
|
||||||
resynch_status[node] = 0x00;
|
|
||||||
resynch_inprogress[node] = true; // So they get the PT_RESYNCHEND...
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250)
|
if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250)
|
||||||
{
|
{
|
||||||
XBOXSTATIC UINT8 buf[2];
|
XBOXSTATIC UINT8 buf[2];
|
||||||
|
@ -2311,8 +2281,6 @@ static void CL_ConnectToServer(boolean viams)
|
||||||
if (gamestate == GS_VOTING)
|
if (gamestate == GS_VOTING)
|
||||||
Y_EndVote();
|
Y_EndVote();
|
||||||
|
|
||||||
resynch_local_inprogress = false; // Just in case this was never cleared...
|
|
||||||
|
|
||||||
DEBFILE(va("waiting %d nodes\n", doomcom->numnodes));
|
DEBFILE(va("waiting %d nodes\n", doomcom->numnodes));
|
||||||
G_SetGamestate(GS_WAITINGPLAYERS);
|
G_SetGamestate(GS_WAITINGPLAYERS);
|
||||||
wipegamestate = GS_WAITINGPLAYERS;
|
wipegamestate = GS_WAITINGPLAYERS;
|
||||||
|
@ -3411,7 +3379,6 @@ void D_QuitNetGame(void)
|
||||||
HSendPacket(servernode, true, 0, 0);
|
HSendPacket(servernode, true, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
resynch_local_inprogress = false; // No more resyncing!
|
|
||||||
D_CloseConnection();
|
D_CloseConnection();
|
||||||
ClearAdminPlayers();
|
ClearAdminPlayers();
|
||||||
|
|
||||||
|
|
90
src/d_net.c
90
src/d_net.c
|
@ -339,7 +339,6 @@ 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)
|
||||||
{
|
{
|
||||||
DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack));
|
DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack));
|
||||||
|
@ -362,7 +361,6 @@ static boolean Processackpak(void)
|
||||||
// Is a good packet so increment the acknowledge number,
|
// Is a good packet so increment the acknowledge number,
|
||||||
// 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);
|
||||||
|
|
||||||
if (!nextfirstack)
|
if (!nextfirstack)
|
||||||
nextfirstack = 1;
|
nextfirstack = 1;
|
||||||
|
|
||||||
|
@ -781,8 +779,6 @@ static const char *packettypename[NUMPACKETTYPE] =
|
||||||
{
|
{
|
||||||
"NOTHING",
|
"NOTHING",
|
||||||
"SERVERCFG",
|
"SERVERCFG",
|
||||||
|
|
||||||
|
|
||||||
"CLIENTCMD",
|
"CLIENTCMD",
|
||||||
"CLIENTMIS",
|
"CLIENTMIS",
|
||||||
"CLIENT2CMD",
|
"CLIENT2CMD",
|
||||||
|
@ -803,9 +799,6 @@ static const char *packettypename[NUMPACKETTYPE] =
|
||||||
"RESYNCHEND",
|
"RESYNCHEND",
|
||||||
"RESYNCHGET",
|
"RESYNCHGET",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"CLIENT3CMD",
|
"CLIENT3CMD",
|
||||||
"CLIENT3MIS",
|
"CLIENT3MIS",
|
||||||
"CLIENT4CMD",
|
"CLIENT4CMD",
|
||||||
|
@ -813,20 +806,13 @@ static const char *packettypename[NUMPACKETTYPE] =
|
||||||
"BASICKEEPALIVE",
|
"BASICKEEPALIVE",
|
||||||
|
|
||||||
"FILEFRAGMENT",
|
"FILEFRAGMENT",
|
||||||
|
|
||||||
"TEXTCMD",
|
"TEXTCMD",
|
||||||
"TEXTCMD2",
|
"TEXTCMD2",
|
||||||
"TEXTCMD3",
|
"TEXTCMD3",
|
||||||
"TEXTCMD4",
|
"TEXTCMD4",
|
||||||
|
|
||||||
"CLIENTJOIN",
|
"CLIENTJOIN",
|
||||||
"NODETIMEOUT",
|
"NODETIMEOUT",
|
||||||
"RESYNCHING",
|
"RESYNCHING",
|
||||||
|
|
||||||
|
|
||||||
"TELLFILESNEEDED",
|
|
||||||
"MOREFILESNEEDED",
|
|
||||||
|
|
||||||
"PING"
|
"PING"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1081,10 +1067,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||||
netbuffer->checksum = NetbufferChecksum();
|
netbuffer->checksum = NetbufferChecksum();
|
||||||
sendbytes += packetheaderlength + doomcom->datalength; // For stat
|
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
|
#ifdef PACKETDROP
|
||||||
// Simulate internet :)
|
// Simulate internet :)
|
||||||
//if (rand() >= (INT32)(RAND_MAX * (PACKETLOSSRATE / 100.f)))
|
//if (rand() >= (INT32)(RAND_MAX * (PACKETLOSSRATE / 100.f)))
|
||||||
|
@ -1121,7 +1103,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||||
//
|
//
|
||||||
boolean HGetPacket(void)
|
boolean HGetPacket(void)
|
||||||
{
|
{
|
||||||
boolean nodejustjoined;
|
//boolean nodejustjoined;
|
||||||
|
|
||||||
// Get a packet from self
|
// Get a packet from self
|
||||||
if (rebound_tail != rebound_head)
|
if (rebound_tail != rebound_head)
|
||||||
|
@ -1148,56 +1130,11 @@ boolean HGetPacket(void)
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
nodejustjoined = I_NetGet();
|
//nodejustjoined = I_NetGet();
|
||||||
//I_NetGet();
|
I_NetGet();
|
||||||
|
|
||||||
if (doomcom->remotenode == -1) // No packet received
|
if (doomcom->remotenode == -1) // No packet received
|
||||||
{
|
return false;
|
||||||
if (nodejustjoined) // _This_ means we did receive a packet, but either from a node we couldn't allocate or a gone player ackreting...
|
|
||||||
continue;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nodejustjoined)
|
|
||||||
{
|
|
||||||
// If a new node sends an unexpected packet, just ignore it
|
|
||||||
if (server
|
|
||||||
&& !(netbuffer->packettype == PT_ASKINFO
|
|
||||||
|| netbuffer->packettype == PT_SERVERINFO
|
|
||||||
|| netbuffer->packettype == PT_PLAYERINFO
|
|
||||||
|| netbuffer->packettype == PT_REQUESTFILE
|
|
||||||
|| netbuffer->packettype == PT_ASKINFOVIAMS
|
|
||||||
|| netbuffer->packettype == PT_CLIENTJOIN
|
|
||||||
|| netbuffer->packettype == PT_TELLFILESNEEDED
|
|
||||||
|| netbuffer->packettype == PT_CLIENTCMD))
|
|
||||||
{
|
|
||||||
DEBFILE(va("New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]));
|
|
||||||
CONS_Alert(CONS_NOTICE, "New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]);
|
|
||||||
Net_CloseConnection(doomcom->remotenode | FORCECLOSE);
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
DEBFILE("New node sent a packet with an out-of-sequence ack. Ghost connection? Ignoring...\n");
|
|
||||||
CONS_Alert(CONS_NOTICE, "New node sent a packet with an out-of-sequence ack. Ghost connection? Ignoring...\n");
|
|
||||||
Net_CloseConnection(doomcom->remotenode | FORCECLOSE);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reinitialize vars for the new node just in case there's anything left over from other players.....
|
|
||||||
InitNode(&nodes[doomcom->remotenode]);
|
|
||||||
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
|
getbytes += packetheaderlength + doomcom->datalength; // For stat
|
||||||
|
|
||||||
|
@ -1212,8 +1149,8 @@ boolean HGetPacket(void)
|
||||||
if (netbuffer->checksum != NetbufferChecksum())
|
if (netbuffer->checksum != NetbufferChecksum())
|
||||||
{
|
{
|
||||||
DEBFILE("Bad packet checksum\n");
|
DEBFILE("Bad packet checksum\n");
|
||||||
Net_CloseConnection(nodejustjoined ? (doomcom->remotenode | FORCECLOSE) : doomcom->remotenode);
|
//Net_CloseConnection(nodejustjoined ? (doomcom->remotenode | FORCECLOSE) : doomcom->remotenode);
|
||||||
//Net_CloseConnection(doomcom->remotenode);
|
Net_CloseConnection(doomcom->remotenode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,6 +1159,21 @@ boolean HGetPacket(void)
|
||||||
DebugPrintpacket("GET");
|
DebugPrintpacket("GET");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*// If a new node sends an unexpected packet, just ignore it
|
||||||
|
if (nodejustjoined && server
|
||||||
|
&& !(netbuffer->packettype == PT_ASKINFO
|
||||||
|
|| netbuffer->packettype == PT_SERVERINFO
|
||||||
|
|| netbuffer->packettype == PT_PLAYERINFO
|
||||||
|
|| netbuffer->packettype == PT_REQUESTFILE
|
||||||
|
|| netbuffer->packettype == PT_ASKINFOVIAMS
|
||||||
|
|| netbuffer->packettype == PT_CLIENTJOIN))
|
||||||
|
{
|
||||||
|
DEBFILE(va("New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]));
|
||||||
|
//CONS_Alert(CONS_NOTICE, "New node sent an unexpected %s packet\n", packettypename[netbuffer->packettype]);
|
||||||
|
Net_CloseConnection(doomcom->remotenode | FORCECLOSE);
|
||||||
|
continue;
|
||||||
|
}*/
|
||||||
|
|
||||||
// Proceed the ack and ackreturn field
|
// Proceed the ack and ackreturn field
|
||||||
if (!Processackpak())
|
if (!Processackpak())
|
||||||
continue; // discarded (duplicated)
|
continue; // discarded (duplicated)
|
||||||
|
|
15
src/i_tcp.c
15
src/i_tcp.c
|
@ -508,8 +508,6 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SOCK_FreeNodenum(INT32 numnode);
|
|
||||||
|
|
||||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
// 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.
|
// 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.
|
/** \warning This function causes the file downloading to stop if someone joins.
|
||||||
|
@ -526,7 +524,7 @@ static void cleanupnodes(void)
|
||||||
// Why can't I start at zero?
|
// Why can't I start at zero?
|
||||||
for (j = 1; j < MAXNETNODES; j++)
|
for (j = 1; j < MAXNETNODES; j++)
|
||||||
if (!(nodeingame[j] || SV_SendingFile(j)))
|
if (!(nodeingame[j] || SV_SendingFile(j)))
|
||||||
SOCK_FreeNodenum(j); // At least free this PROPERLY
|
nodeconnected[j] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SINT8 getfreenode(void)
|
static SINT8 getfreenode(void)
|
||||||
|
@ -626,13 +624,6 @@ static boolean SOCK_Get(void)
|
||||||
}
|
}
|
||||||
// not found
|
// not found
|
||||||
|
|
||||||
if (netbuffer->packettype == PT_NOTHING)
|
|
||||||
{
|
|
||||||
DEBFILE(va("Ackret received from disconnected address:%s, ignoring...\n", SOCK_AddrToStr(&fromaddress)));
|
|
||||||
doomcom->remotenode = -1; // no packet
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a free slot
|
// find a free slot
|
||||||
j = getfreenode();
|
j = getfreenode();
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
|
@ -659,11 +650,7 @@ static boolean SOCK_Get(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
DEBFILE("New node detected: No more free slots\n");
|
DEBFILE("New node detected: No more free slots\n");
|
||||||
doomcom->remotenode = -1; // no packet
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue