mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-08-23 23:40:54 +00:00
Fix InvalidBuffedError on incomplete recv data (#4740)
Co-authored-by: Maksym Veremchuk <jack.j2m@proton.me>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import struct
|
||||
from zlib import crc32
|
||||
|
||||
@@ -22,7 +23,10 @@ class FullPacketCodec(PacketCodec):
|
||||
return data + crc
|
||||
|
||||
async def read_packet(self, reader):
|
||||
packet_len_seq = await reader.readexactly(8) # 4 and 4
|
||||
try:
|
||||
packet_len_seq = await reader.readexactly(8) # 4 and 4
|
||||
except asyncio.IncompleteReadError as exc:
|
||||
return exc.partial
|
||||
packet_len, seq = struct.unpack('<ii', packet_len_seq)
|
||||
if packet_len < 0 and seq < 0:
|
||||
# It has been observed that the length and seq can be -429,
|
||||
|
||||
Reference in New Issue
Block a user