Skip to content

Commit

Permalink
Fix some UDP packet size issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr_Goldberg committed Sep 3, 2022
1 parent 05e2c3b commit 373801b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dll/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static uint32_t upper_range_ips[MAX_BROADCASTS];
#define HEARTBEAT_TIMEOUT 20.0
#define USER_TIMEOUT 20.0

#define MAX_UDP_SIZE 16384

#if defined(STEAM_WIN32)

//windows xp support
Expand Down Expand Up @@ -925,7 +927,7 @@ void Networking::Run()
}

IP_PORT ip_port;
char data[2048];
char data[MAX_UDP_SIZE];
int len;

PRINT_DEBUG("RECV UDP\n");
Expand Down Expand Up @@ -1178,7 +1180,7 @@ bool Networking::sendTo(Common_Message *msg, bool reliable, Connection *conn)
if (!enabled) return false;

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;
CSteamID dest_id((uint64)msg->dest_id());
Expand Down

0 comments on commit 373801b

Please sign in to comment.