mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2025-12-06 07:12:04 +01:00
fix errors
This commit is contained in:
parent
096d6fefe3
commit
50095bf4a7
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -221,7 +221,7 @@ def test_serverHighLoad(getRunningServer):
|
||||||
logging.debug("start sendThreads")
|
logging.debug("start sendThreads")
|
||||||
threads = []
|
threads = []
|
||||||
for thr_id in range(10):
|
for thr_id in range(10):
|
||||||
thr = threading.Thread(target=sendThread, name="sendThread-"+str(thr_id))
|
thr = threading.Thread(target=sendThread, name="sendThread-" + str(thr_id))
|
||||||
thr.daemon = True
|
thr.daemon = True
|
||||||
thr.start()
|
thr.start()
|
||||||
threads.append(thr)
|
threads.append(thr)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue