mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Set a time threshold in test_asyncore.capture_server so that tests don't
deadlock if the main thread fails before sending all the data.
This commit is contained in:
parent
f3be68e0a8
commit
b2e58185e5
1 changed files with 4 additions and 3 deletions
|
@ -74,15 +74,16 @@ def capture_server(evt, buf, serv):
|
|||
pass
|
||||
else:
|
||||
n = 200
|
||||
while n > 0:
|
||||
r, w, e = select.select([conn], [], [])
|
||||
start = time.time()
|
||||
while n > 0 and time.time() - start < 3.0:
|
||||
r, w, e = select.select([conn], [], [], 0.1)
|
||||
if r:
|
||||
n -= 1
|
||||
data = conn.recv(10)
|
||||
# keep everything except for the newline terminator
|
||||
buf.write(data.replace(b'\n', b''))
|
||||
if b'\n' in data:
|
||||
break
|
||||
n -= 1
|
||||
time.sleep(0.01)
|
||||
|
||||
conn.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue