Skip to content

Commit 1fc160c

Browse files
committed
Make TCPIntermediateO async
1 parent 78a768f commit 1fc160c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

pyrogram/connection/transport/tcp/tcp_intermediate_o.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def __init__(self, ipv6: bool, proxy: dict):
3535
self.encrypt = None
3636
self.decrypt = None
3737

38-
def connect(self, address: tuple):
39-
super().connect(address)
38+
async def connect(self, address: tuple):
39+
await super().connect(address)
4040

4141
while True:
4242
nonce = bytearray(os.urandom(64))
@@ -54,25 +54,25 @@ def connect(self, address: tuple):
5454

5555
nonce[56:64] = AES.ctr256_encrypt(nonce, *self.encrypt)[56:64]
5656

57-
super().sendall(nonce)
57+
await super().send(nonce)
5858

59-
def sendall(self, data: bytes, *args):
60-
super().sendall(
59+
async def send(self, data: bytes, *args):
60+
await super().send(
6161
AES.ctr256_encrypt(
6262
pack("<i", len(data)) + data,
6363
*self.encrypt
6464
)
6565
)
6666

67-
def recvall(self, length: int = 0) -> bytes or None:
68-
length = super().recvall(4)
67+
async def recv(self, length: int = 0) -> bytes or None:
68+
length = await super().recv(4)
6969

7070
if length is None:
7171
return None
7272

7373
length = AES.ctr256_decrypt(length, *self.decrypt)
7474

75-
data = super().recvall(unpack("<i", length)[0])
75+
data = await super().recv(unpack("<i", length)[0])
7676

7777
if data is None:
7878
return None

0 commit comments

Comments
 (0)