summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2004-07-10 17:36:11 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2004-07-10 17:36:11 (GMT)
commit0fff6c86512283d081f72332f458aa4193e51a81 (patch)
tree5e4de5fddf69e94034d69c09a495a7240f3f46fa
parent88fcca681502f020a75ed17b174ab264c47811c7 (diff)
downloadcpython-0fff6c86512283d081f72332f458aa4193e51a81.zip
cpython-0fff6c86512283d081f72332f458aa4193e51a81.tar.gz
cpython-0fff6c86512283d081f72332f458aa4193e51a81.tar.bz2
In poll(), check connections for exceptional conditions
-rw-r--r--Lib/asyncore.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index 9c36977..f63a83e 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -80,6 +80,14 @@ def write(obj):
except:
obj.handle_error()
+def _exception (obj):
+ try:
+ obj.handle_expt_event()
+ except ExitNow:
+ raise
+ except:
+ obj.handle_error()
+
def readwrite(obj, flags):
try:
if flags & (select.POLLIN | select.POLLPRI):
@@ -99,6 +107,7 @@ def poll(timeout=0.0, map=None):
if map:
r = []; w = []; e = []
for fd, obj in map.items():
+ e.append(fd)
if obj.readable():
r.append(fd)
if obj.writable():
@@ -126,6 +135,12 @@ def poll(timeout=0.0, map=None):
continue
write(obj)
+ for fd in e:
+ obj = map.get(fd)
+ if obj is None:
+ continue
+ _exception(obj)
+
def poll2(timeout=0.0, map=None):
# Use the poll() support added to the select module in Python 2.0
if map is None: