From e2a0de191351002e8b73adabcf54575ea217ce62 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 25 Apr 2018 10:06:11 +0200 Subject: [PATCH] Don't retry forever on TcpClient.connect() --- telethon/extensions/tcp_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telethon/extensions/tcp_client.py b/telethon/extensions/tcp_client.py index 1b7d0113..8a5800fb 100644 --- a/telethon/extensions/tcp_client.py +++ b/telethon/extensions/tcp_client.py @@ -91,7 +91,9 @@ class TcpClient: # to none to recreate it on the next iteration self._socket = None time.sleep(timeout) - timeout = min(timeout * 2, MAX_TIMEOUT) + timeout *= 2 + if timeout > MAX_TIMEOUT: + raise else: raise