mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-26 09:14:31 +03:00
Fix socket may be None when closing twice
This commit is contained in:
parent
a0eb824e87
commit
c8ee0bdca9
|
@ -107,9 +107,10 @@ class TcpClient:
|
|||
|
||||
def close(self):
|
||||
"""Closes the connection."""
|
||||
fd = self._socket.fileno()
|
||||
fd = None
|
||||
try:
|
||||
if self._socket is not None:
|
||||
fd = self._socket.fileno()
|
||||
if self.is_connected:
|
||||
self._socket.shutdown(socket.SHUT_RDWR)
|
||||
self._socket.close()
|
||||
|
|
Loading…
Reference in New Issue
Block a user