1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Send huge unreliable packets by TCP when they are too big.

This commit is contained in:
Mr_Goldberg 2022-05-07 16:37:09 -04:00
parent d215070876
commit 95fc8ac687
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -1153,6 +1153,9 @@ 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
bool ret = false;
CSteamID dest_id((uint64)msg->dest_id());
if (std::find(ids.begin(), ids.end(), dest_id) != ids.end()) {
@ -1178,7 +1181,6 @@ bool Networking::sendTo(Common_Message *msg, bool reliable, Connection *conn)
ret = true;
}
} else {
size_t size = msg->ByteSizeLong();
char *buffer = new char[size];
msg->SerializeToArray(buffer, size);
send_packet_to(udp_socket, conn->udp_ip_port, buffer, size);