diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index a8fca46c..0a799d39 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -33,8 +33,12 @@ class TCP(socket.socket): pass def close(self): - self.shutdown(socket.SHUT_RDWR) - super().close() + try: + self.shutdown(socket.SHUT_RDWR) + except OSError: + pass + finally: + super().close() def recvall(self, length: int) -> bytes or None: data = b""