From 1bf0d931400cd17aa1de694e1326cddadc9af67c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 8 Oct 2018 20:16:44 +0200 Subject: [PATCH] Make TCPFull async --- pyrogram/connection/transport/tcp/tcp_full.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pyrogram/connection/transport/tcp/tcp_full.py b/pyrogram/connection/transport/tcp/tcp_full.py index 8704247b..f6a09953 100644 --- a/pyrogram/connection/transport/tcp/tcp_full.py +++ b/pyrogram/connection/transport/tcp/tcp_full.py @@ -31,34 +31,33 @@ class TCPFull(TCP): self.seq_no = None - def connect(self, address: tuple): - super().connect(address) + async def connect(self, address: tuple): + await super().connect(address) self.seq_no = 0 - def sendall(self, data: bytes, *args): - # 12 = packet_length (4), seq_no (4), crc32 (4) (at the end) + async def send(self, data: bytes, *args): data = pack(" bytes or None: - length = super().recvall(4) + async def recv(self, length: int = 0) -> bytes or None: + length = await super().recv(4) if length is None: return None - packet = super().recvall(unpack("