From 59c61cab2f849cd22139c8d96533f6d14d8ae0af Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 12 Oct 2017 18:41:58 +0200 Subject: [PATCH] Replace int.from_bytes with struct.unpack for consistency --- telethon/network/connection.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/telethon/network/connection.py b/telethon/network/connection.py index 2500c0c1..fe04352f 100644 --- a/telethon/network/connection.py +++ b/telethon/network/connection.py @@ -141,28 +141,25 @@ class Connection: raise ValueError('Invalid connection mode specified: ' + str(self._mode)) def _recv_tcp_full(self): - packet_length_bytes = self.read(4) - packet_length = int.from_bytes(packet_length_bytes, 'little') + packet_len_seq = self.read(8) # 4 and 4 + packet_len, seq = struct.unpack('= 127: - length = int.from_bytes(self.read(3) + b'\0', 'little') + length = struct.unpack('