mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-27 17:54:38 +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):
|
def close(self):
|
||||||
"""Closes the connection."""
|
"""Closes the connection."""
|
||||||
fd = self._socket.fileno()
|
fd = None
|
||||||
try:
|
try:
|
||||||
if self._socket is not None:
|
if self._socket is not None:
|
||||||
|
fd = self._socket.fileno()
|
||||||
if self.is_connected:
|
if self.is_connected:
|
||||||
self._socket.shutdown(socket.SHUT_RDWR)
|
self._socket.shutdown(socket.SHUT_RDWR)
|
||||||
self._socket.close()
|
self._socket.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user