diff options
author | Josiah Carlson <josiah.carlson@gmail.com> | 2009-06-03 19:46:21 (GMT) |
---|---|---|
committer | Josiah Carlson <josiah.carlson@gmail.com> | 2009-06-03 19:46:21 (GMT) |
commit | a810bc736c41eb82fff14f905d0ce35d3f2e5763 (patch) | |
tree | 98d6538ec183162c39a99cbb4007239c9b7da2a1 | |
parent | 8df921b46b0c6467ddd7e09279db981a076b5f95 (diff) | |
download | cpython-a810bc736c41eb82fff14f905d0ce35d3f2e5763.zip cpython-a810bc736c41eb82fff14f905d0ce35d3f2e5763.tar.gz cpython-a810bc736c41eb82fff14f905d0ce35d3f2e5763.tar.bz2 |
This fixes bug 5798 on OS X.
This should also fix disconnect behavior cross-platform.
-rw-r--r-- | Lib/asyncore.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 4f1153b..3672db9 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -101,10 +101,16 @@ 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, e: + if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, +ECONNABORTED): + obj.handle_error() + else: + obj.handle_close() except _reraised_exceptions: raise except: |