mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Set a known buffer size if possible on BinaryWriter()s
This commit is contained in:
@@ -20,7 +20,7 @@ class MtProtoPlainSender:
|
||||
|
||||
def send(self, data):
|
||||
"""Sends a plain packet (auth_key_id = 0) containing the given message body (data)"""
|
||||
with BinaryWriter() as writer:
|
||||
with BinaryWriter(known_length=len(data) + 20) as writer:
|
||||
writer.write_long(0)
|
||||
writer.write_long(self._get_new_msg_id())
|
||||
writer.write_int(len(data))
|
||||
|
Reference in New Issue
Block a user