switch to compression with limit at 30 MB

This commit is contained in:
Lion Kortlepel
2024-06-22 22:48:00 +02:00
parent e0e2607632
commit f2b34543f9
5 changed files with 68 additions and 54 deletions

View File

@@ -6,6 +6,7 @@
/// Created by Anonymous275 on 7/25/2020
///
#include "Network/network.hpp"
#include <zlib.h>
#if defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -93,6 +94,8 @@ void ServerSend(std::string Data, bool Rel) {
Ack = true;
if (C == 'N' || C == 'W' || C == 'Y' || C == 'V' || C == 'E' || C == 'C')
Rel = true;
if (compressBound(Data.size()) > 1024)
Rel = true;
if (Ack || Rel) {
if (Ack || DLen > 1000)
SendLarge(Data);
@@ -296,4 +299,4 @@ void TCPGameServer(const std::string& IP, int Port) {
if (CSocket != SOCKET_ERROR)
KillSocket(CSocket);
debug("END OF GAME SERVER");
}
}