From 5f414626efabc94076f19da8a94f5cb14cbb5430 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 16 May 2018 21:14:05 +0200 Subject: [PATCH] Refactor tcp_intermediate --- .../connection/transport/tcp/tcp_intermediate.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate.py b/pyrogram/connection/transport/tcp/tcp_intermediate.py index 55a7d071..d99ca463 100644 --- a/pyrogram/connection/transport/tcp/tcp_intermediate.py +++ b/pyrogram/connection/transport/tcp/tcp_intermediate.py @@ -27,22 +27,15 @@ log = logging.getLogger(__name__) class TCPIntermediate(TCP): def __init__(self, proxy: dict): super().__init__(proxy) - self.is_first_packet = None def connect(self, address: tuple): super().connect(address) - self.is_first_packet = True + super().sendall(b"\xee" * 4) + log.info("Connected{}!".format(" with proxy" if self.proxy_enabled else "")) def sendall(self, data: bytes, *args): - length = len(data) - data = pack(" bytes or None: length = super().recvall(4) @@ -50,4 +43,4 @@ class TCPIntermediate(TCP): if length is None: return None - return super().recvall(unpack("