From ead0b4f029561fa55e57805de25425fa98ca6c09 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 10 Jun 2018 16:15:19 +0200 Subject: [PATCH] Use more relevant names for Connection fields --- pyrogram/connection/connection.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py index cab31b62..b4705fca 100644 --- a/pyrogram/connection/connection.py +++ b/pyrogram/connection/connection.py @@ -40,17 +40,17 @@ class Connection: self.proxy = proxy self.mode = self.MODES.get(mode, TCPAbridged) - self.connection = None # type: TCP + self.protocol = None # type: TCP async def connect(self): for i in range(Connection.MAX_RETRIES): - self.connection = self.mode(self.proxy) + self.protocol = self.mode(self.proxy) try: log.info("Connecting...") - await self.connection.connect(self.address) + await self.protocol.connect(self.address) except OSError: - self.connection.close() + self.protocol.close() await asyncio.sleep(1) else: break @@ -58,11 +58,11 @@ class Connection: raise TimeoutError def close(self): - self.connection.close() + self.protocol.close() log.info("Disconnected") async def send(self, data: bytes): - await self.connection.send(data) + await self.protocol.send(data) async def recv(self) -> bytes or None: - return await self.connection.recv() + return await self.protocol.recv()