mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Fix socket may be None when closing twice
This commit is contained in:
@@ -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()
|
||||||
|
Reference in New Issue
Block a user