summaryrefslogtreecommitdiffstats
path: root/Lib/asyncore.py
diff options
context:
space:
mode:
authorJosiah Carlson <josiah.carlson@gmail.com>2009-06-03 19:48:02 (GMT)
committerJosiah Carlson <josiah.carlson@gmail.com>2009-06-03 19:48:02 (GMT)
commit0abc64d71986902c5ff7e7b9d9fd5c83428ca80b (patch)
tree0cf663fc806675aaf28ae6aa50497f345afc90f4 /Lib/asyncore.py
parentb1614a7b6705f939b29df4045e591fcf53a8611b (diff)
downloadcpython-0abc64d71986902c5ff7e7b9d9fd5c83428ca80b.zip
cpython-0abc64d71986902c5ff7e7b9d9fd5c83428ca80b.tar.gz
cpython-0abc64d71986902c5ff7e7b9d9fd5c83428ca80b.tar.bz2
This fixes bug 5798 on OS X.
This should also fix disconnect behavior cross-platform.
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r--Lib/asyncore.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index e4f9bf9..db426d7 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -100,10 +100,15 @@ def readwrite(obj, flags):
obj.handle_read_event()
if flags & select.POLLOUT:
obj.handle_write_event()
- if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
- obj.handle_close()
if flags & select.POLLPRI:
obj.handle_expt_event()
+ if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
+ obj.handle_close()
+ except socket.error as e:
+ if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
+ obj.handle_error()
+ else:
+ obj.handle_close()
except _reraised_exceptions:
raise
except: