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
def isConnected(self):
"""!Property of client connected state"""
_, write, _ = select.select([], [self._sock], [], 0.1)
if write:
try:
if self._sock:
read, write, _ = select.select([], [self._sock], [], 0.1)
if read and write:
return True
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"""
getClient.connect()
getRunningServer.stop()
timeout = 10
timeout = 5
while getClient.isConnected:
time.sleep(0.1)
timeout = timeout - 1