mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-29 08:05:50 +03:00
Fixed NET_QueuePacket workflow
This commit is contained in:
parent
469908f5c5
commit
d15ebf6df2
@ -860,6 +860,10 @@ qboolean NET_GetLong(unsigned char *pData, int size, int *outSize)
|
||||
|
||||
qboolean NET_QueuePacket(netsrc_t sock)
|
||||
{
|
||||
#ifdef REHLDS_FIXES
|
||||
while (true)
|
||||
#endif // REHLDS_FIXES
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned char buf[MAX_UDP_PACKET];
|
||||
|
||||
@ -917,10 +921,21 @@ qboolean NET_QueuePacket(netsrc_t sock)
|
||||
Con_NetPrintf("%s: Oversize packet from %s\n", __func__, NET_AdrToString(in_from));
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (ret == -1)
|
||||
{
|
||||
return NET_LagPacket(FALSE, sock, NULL, NULL);
|
||||
}
|
||||
if (ret == MAX_UDP_PACKET)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
if (ret == -1 || ret == MAX_UDP_PACKET)
|
||||
{
|
||||
return NET_LagPacket(FALSE, sock, NULL, NULL);
|
||||
}
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
NET_TransferRawData(&in_message, buf, ret);
|
||||
|
||||
@ -932,7 +947,11 @@ qboolean NET_QueuePacket(netsrc_t sock)
|
||||
if (in_message.cursize < 9)
|
||||
{
|
||||
Con_NetPrintf("Invalid split packet length %i\n", in_message.cursize);
|
||||
#ifdef REHLDS_FIXES
|
||||
continue;
|
||||
#else // REHLDS_FIXES
|
||||
return FALSE;
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
@ -940,11 +959,21 @@ qboolean NET_QueuePacket(netsrc_t sock)
|
||||
if (sock == NS_SERVER)
|
||||
{
|
||||
Con_NetPrintf("Someone tries to send split packet to the server\n");
|
||||
return FALSE;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!NET_GetLong(in_message.data, ret, &in_message.cursize))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#else // REHLDS_FIXES
|
||||
return NET_GetLong(in_message.data, ret, &in_message.cursize);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT int NET_Sleep_Timeout()
|
||||
|
Loading…
Reference in New Issue
Block a user