mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Always try to reconnect within Connection
This commit is contained in:
parent
2c1d3ee2a4
commit
03629d5ee9
@ -27,8 +27,6 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Connection:
|
||||
MAX_RETRIES = 3
|
||||
|
||||
MODES = {
|
||||
0: TCPFull,
|
||||
1: TCPAbridged,
|
||||
@ -50,7 +48,7 @@ class Connection:
|
||||
self.is_connected = asyncio.Event()
|
||||
|
||||
async def connect(self):
|
||||
for i in range(Connection.MAX_RETRIES):
|
||||
while True:
|
||||
self.protocol = self.mode(self.ipv6, self.proxy)
|
||||
|
||||
try:
|
||||
@ -69,9 +67,6 @@ class Connection:
|
||||
self.mode.__name__,
|
||||
))
|
||||
break
|
||||
else:
|
||||
log.warning("Couldn't connect. Trying again...")
|
||||
raise TimeoutError
|
||||
|
||||
self.is_connected.set()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user