From 0868e05528c596820c08e7af41e6c65470023e70 Mon Sep 17 00:00:00 2001 From: Javad Date: Tue, 16 Apr 2024 22:20:37 +0330 Subject: [PATCH] MTProtoSender: Dont try to reconnenct in background when auto_reconnect flag is not active --- telethon/network/mtprotosender.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/telethon/network/mtprotosender.py b/telethon/network/mtprotosender.py index 6c3e30c12..d9b906e0d 100644 --- a/telethon/network/mtprotosender.py +++ b/telethon/network/mtprotosender.py @@ -416,6 +416,8 @@ async def _reconnect(self, last_error): def _start_reconnect(self, error): """Starts a reconnection in the background.""" + if not self._auto_reconnect and error is not None: + raise error if self._user_connected and not self._reconnecting: # We set reconnecting to True here and not inside the new task # because it may happen that send/recv loop calls this again