summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-07-19 23:57:38 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2007-07-19 23:57:38 (GMT)
commitb1994b4a5d0139a010eb0af1d6615a3df92fe786 (patch)
treed56d5141e8a21198faf736244d3152db4e2f04da
parent219336af8288c9b472a37090b9ae46ec18bdcae5 (diff)
downloadcpython-b1994b4a5d0139a010eb0af1d6615a3df92fe786.zip
cpython-b1994b4a5d0139a010eb0af1d6615a3df92fe786.tar.gz
cpython-b1994b4a5d0139a010eb0af1d6615a3df92fe786.tar.bz2
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]
-rw-r--r--Lib/test/test_asyncore.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
index 7602b9f..03481e8 100644
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -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)