mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 19:16:43 +00:00
Ignore EBADF when closing the socket
This commit is contained in:
parent
68cdc9eaf1
commit
626778bd32
@ -56,9 +56,8 @@ class TcpClient:
|
|||||||
if self.connected:
|
if self.connected:
|
||||||
self._socket.shutdown(socket.SHUT_RDWR)
|
self._socket.shutdown(socket.SHUT_RDWR)
|
||||||
self._socket.close()
|
self._socket.close()
|
||||||
except OSError as e:
|
except OSError:
|
||||||
if e.errno != errno.ENOTCONN:
|
pass # Ignore ENOTCONN, EBADF, and any other error when closing
|
||||||
raise
|
|
||||||
finally:
|
finally:
|
||||||
self._socket = None
|
self._socket = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user