fix errors

This commit is contained in:
Bastian Schroll 2019-10-23 09:19:32 +02:00
parent 096d6fefe3
commit 50095bf4a7
2 changed files with 11 additions and 6 deletions

View file

@ -105,7 +105,12 @@ class TCPClient:
@property @property
def isConnected(self): def isConnected(self):
"""!Property of client connected state""" """!Property of client connected state"""
_, write, _ = select.select([], [self._sock], [], 0.1) try:
if write: if self._sock:
read, write, _ = select.select([], [self._sock], [], 0.1)
if read and write:
return True return True
return False return False
except:
logging.exception("cannot check connection status")
return False

View file

@ -182,7 +182,7 @@ def test_serverStopsWhileConnected(getRunningServer, getClient):
"""!Shutdown server while client is connected""" """!Shutdown server while client is connected"""
getClient.connect() getClient.connect()
getRunningServer.stop() getRunningServer.stop()
timeout = 10 timeout = 5
while getClient.isConnected: while getClient.isConnected:
time.sleep(0.1) time.sleep(0.1)
timeout = timeout - 1 timeout = timeout - 1