mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Several updates, fixes and additions (TcpClient, MtProto...)
README.md was updated to reflect more useful information More errors from the official Telegrm website have been added MtProtoSender now handles updates (and doesn't crash!) Fixes on TcpClient to be able to receive whole large packets Updated scheme.tl to the layer 55 Session is now saved more often (to prevent damages from crashes) Fixes to the code generator (generated invalid code for reading "bytes")
This commit is contained in:
@@ -23,4 +23,11 @@ class TcpClient:
|
||||
|
||||
def read(self, buffer_size):
|
||||
"""Reads (receives) the specified bytes from the connected peer"""
|
||||
return self.socket.recv(buffer_size)
|
||||
# TODO improve (don't cast to list, use a mutable byte list instead or similar, see recv_into)
|
||||
result = []
|
||||
while len(result) < buffer_size:
|
||||
left_data = buffer_size - len(result)
|
||||
partial = self.socket.recv(left_data)
|
||||
result.extend(list(partial))
|
||||
|
||||
return bytes(result)
|
||||
|
Reference in New Issue
Block a user