mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 22:00:50 +00:00
Attempts to prevent stupid stuff from happening
This commit is contained in:
parent
b564c8ab9a
commit
5a1fc6098e
2 changed files with 14 additions and 2 deletions
|
@ -3936,6 +3936,9 @@ FILESTAMP
|
||||||
|
|
||||||
while (HGetPacket())
|
while (HGetPacket())
|
||||||
{
|
{
|
||||||
|
if (doomcom->remotenode == -1) // ...this should have been ignored already
|
||||||
|
continue; // might come from PT_NODETIMEOUT somehow though
|
||||||
|
|
||||||
node = (SINT8)doomcom->remotenode;
|
node = (SINT8)doomcom->remotenode;
|
||||||
|
|
||||||
if (netbuffer->packettype == PT_CLIENTJOIN && server)
|
if (netbuffer->packettype == PT_CLIENTJOIN && server)
|
||||||
|
@ -3968,8 +3971,10 @@ FILESTAMP
|
||||||
if (netbuffer->packettype == PT_PLAYERINFO)
|
if (netbuffer->packettype == PT_PLAYERINFO)
|
||||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
||||||
|
|
||||||
|
if (node < 0 || node >= MAXNETNODES) // THIS SHOULDN'T EVEN BE POSSIBLE
|
||||||
|
; //CONS_Printf("Received packet from node %d!\n", (int)node);
|
||||||
// Packet received from someone already playing
|
// Packet received from someone already playing
|
||||||
if (nodeingame[node])
|
else if (nodeingame[node])
|
||||||
HandlePacketFromPlayer(node);
|
HandlePacketFromPlayer(node);
|
||||||
// Packet received from someone not playing
|
// Packet received from someone not playing
|
||||||
else
|
else
|
||||||
|
|
|
@ -711,6 +711,10 @@ void Net_CloseConnection(INT32 node)
|
||||||
#else
|
#else
|
||||||
INT32 i;
|
INT32 i;
|
||||||
boolean forceclose = (node & FORCECLOSE) != 0;
|
boolean forceclose = (node & FORCECLOSE) != 0;
|
||||||
|
|
||||||
|
if (node == -1)
|
||||||
|
return; // nope, just ignore it
|
||||||
|
|
||||||
node &= ~FORCECLOSE;
|
node &= ~FORCECLOSE;
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
|
@ -718,7 +722,7 @@ void Net_CloseConnection(INT32 node)
|
||||||
|
|
||||||
if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game
|
if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node);
|
//CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,6 +1132,9 @@ boolean HGetPacket(void)
|
||||||
doomcom->remotenode = 0;
|
doomcom->remotenode = 0;
|
||||||
|
|
||||||
rebound_tail = (rebound_tail+1) % MAXREBOUND;
|
rebound_tail = (rebound_tail+1) % MAXREBOUND;
|
||||||
|
|
||||||
|
if (doomcom->remotenode == -1) // wait hang on what?
|
||||||
|
return true; // there might still be packets from others though, so don't return false
|
||||||
#ifdef DEBUGFILE
|
#ifdef DEBUGFILE
|
||||||
if (debugfile)
|
if (debugfile)
|
||||||
DebugPrintpacket("GETLOCAL");
|
DebugPrintpacket("GETLOCAL");
|
||||||
|
|
Loading…
Reference in a new issue