mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 08:15:42 +00:00
Compress DATA
This commit is contained in:
parent
69348e9339
commit
a226b17612
@ -113,11 +113,7 @@ class Client:
|
||||
continue
|
||||
if not to_udp or code in ['V', 'W', 'Y', 'E']:
|
||||
if code in ['O', 'T'] or len(data) > 1000:
|
||||
if len(data) > 400:
|
||||
# TODO: Compress data
|
||||
await client._send(data)
|
||||
else:
|
||||
await client._send(data)
|
||||
await client._send(data)
|
||||
else:
|
||||
await client._send(data)
|
||||
else:
|
||||
@ -125,6 +121,9 @@ class Client:
|
||||
self.log.debug(f"UDP Part not ready: {code}")
|
||||
return
|
||||
|
||||
if len(data) > 400:
|
||||
data = b"ABG:" + zlib.compress(data, level=zlib.Z_BEST_COMPRESSION)
|
||||
|
||||
header = len(data).to_bytes(4, "little", signed=True)
|
||||
self.log.debug(f'len: {len(data)}; send: {header + data!r}')
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user