mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 07:24:51 +00:00
Use more relevant names for Connection fields
This commit is contained in:
parent
6ab60c0d36
commit
ead0b4f029
1 changed files with 7 additions and 7 deletions
|
|
@ -40,17 +40,17 @@ class Connection:
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
self.mode = self.MODES.get(mode, TCPAbridged)
|
self.mode = self.MODES.get(mode, TCPAbridged)
|
||||||
|
|
||||||
self.connection = None # type: TCP
|
self.protocol = None # type: TCP
|
||||||
|
|
||||||
async def connect(self):
|
async def connect(self):
|
||||||
for i in range(Connection.MAX_RETRIES):
|
for i in range(Connection.MAX_RETRIES):
|
||||||
self.connection = self.mode(self.proxy)
|
self.protocol = self.mode(self.proxy)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log.info("Connecting...")
|
log.info("Connecting...")
|
||||||
await self.connection.connect(self.address)
|
await self.protocol.connect(self.address)
|
||||||
except OSError:
|
except OSError:
|
||||||
self.connection.close()
|
self.protocol.close()
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
@ -58,11 +58,11 @@ class Connection:
|
||||||
raise TimeoutError
|
raise TimeoutError
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.connection.close()
|
self.protocol.close()
|
||||||
log.info("Disconnected")
|
log.info("Disconnected")
|
||||||
|
|
||||||
async def send(self, data: bytes):
|
async def send(self, data: bytes):
|
||||||
await self.connection.send(data)
|
await self.protocol.send(data)
|
||||||
|
|
||||||
async def recv(self) -> bytes or None:
|
async def recv(self) -> bytes or None:
|
||||||
return await self.connection.recv()
|
return await self.protocol.recv()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue