Fix some UDP packet size issues

This commit is contained in:
Mr_Goldberg 2022-09-03 04:21:08 -04:00
parent 05e2c3bef0
commit 373801b3a4
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -27,6 +27,8 @@ static uint32_t upper_range_ips[MAX_BROADCASTS];
#define HEARTBEAT_TIMEOUT 20.0 #define HEARTBEAT_TIMEOUT 20.0
#define USER_TIMEOUT 20.0 #define USER_TIMEOUT 20.0
#define MAX_UDP_SIZE 16384
#if defined(STEAM_WIN32) #if defined(STEAM_WIN32)
//windows xp support //windows xp support
@ -925,7 +927,7 @@ void Networking::Run()
} }
IP_PORT ip_port; IP_PORT ip_port;
char data[2048]; char data[MAX_UDP_SIZE];
int len; int len;
PRINT_DEBUG("RECV UDP\n"); PRINT_DEBUG("RECV UDP\n");
@ -1178,7 +1180,7 @@ bool Networking::sendTo(Common_Message *msg, bool reliable, Connection *conn)
if (!enabled) return false; if (!enabled) return false;
size_t size = msg->ByteSizeLong(); size_t size = msg->ByteSizeLong();
if (size >= 65000) reliable = true; //too big for UDP if (size >= MAX_UDP_SIZE) reliable = true; //too big for UDP
bool ret = false; bool ret = false;
CSteamID dest_id((uint64)msg->dest_id()); CSteamID dest_id((uint64)msg->dest_id());