mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Added a select.select call in the test server loop to make sure the
socket is ready to be read from before attempting a read (this prevents an error 10035 on some Windows platforms). [GSoC - Alan McIntyre]
This commit is contained in:
parent
219336af82
commit
b1994b4a5d
1 changed files with 7 additions and 5 deletions
|
|
@ -65,11 +65,13 @@ def capture_server(evt, buf):
|
|||
else:
|
||||
n = 200
|
||||
while n > 0:
|
||||
data = conn.recv(10)
|
||||
# keep everything except for the newline terminator
|
||||
buf.write(data.replace('\n', ''))
|
||||
if '\n' in data:
|
||||
break
|
||||
r, w, e = select.select([conn], [], [])
|
||||
if r:
|
||||
data = conn.recv(10)
|
||||
# keep everything except for the newline terminator
|
||||
buf.write(data.replace('\n', ''))
|
||||
if '\n' in data:
|
||||
break
|
||||
n -= 1
|
||||
time.sleep(0.01)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue