From b0e587c03d9e60998d0c2462bdfef2799545ad6b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 26 Oct 2018 10:36:33 +0200 Subject: [PATCH] Except expected ConnectionError in the receive loop --- telethon/network/connection/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/network/connection/connection.py b/telethon/network/connection/connection.py index 625635e3..4f1e9955 100644 --- a/telethon/network/connection/connection.py +++ b/telethon/network/connection/connection.py @@ -163,7 +163,7 @@ class Connection(abc.ABC): except asyncio.CancelledError: pass except Exception as e: - if isinstance(e, asyncio.IncompleteReadError): + if isinstance(e, (ConnectionError, asyncio.IncompleteReadError)): msg = 'The server closed the connection' __log__.info(msg) elif isinstance(e, InvalidChecksumError):