correctly disconnect and set retrieve connection state
This commit is contained in:
parent
965a536779
commit
fab644fd47
1 changed files with 4 additions and 1 deletions
5
mcg.py
5
mcg.py
|
@ -133,7 +133,7 @@ class Client(Base):
|
|||
|
||||
def is_connected(self):
|
||||
"""Return the connection status."""
|
||||
return self._worker is not None
|
||||
return self._worker is not None and self._worker.is_alive()
|
||||
|
||||
|
||||
def disconnect(self):
|
||||
|
@ -264,10 +264,13 @@ class Client(Base):
|
|||
def _disconnect_socket(self):
|
||||
if self._sock_read is not None:
|
||||
self._sock_read.close()
|
||||
self._sock_read = None
|
||||
if self._sock_write is not None:
|
||||
self._sock_write.close()
|
||||
self._sock_write = None
|
||||
if self._sock is not None:
|
||||
self._sock.close()
|
||||
self._sock = None
|
||||
self._logger.info("disconnected")
|
||||
self._set_connection_status(False)
|
||||
|
||||
|
|
Loading…
Reference in a new issue