Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0abc64d

Browse files
committed
This fixes bug 5798 on OS X.
This should also fix disconnect behavior cross-platform.
1 parent b1614a7 commit 0abc64d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/asyncore.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ def readwrite(obj, flags):
100100
obj.handle_read_event()
101101
if flags & select.POLLOUT:
102102
obj.handle_write_event()
103-
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
104-
obj.handle_close()
105103
if flags & select.POLLPRI:
106104
obj.handle_expt_event()
105+
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
106+
obj.handle_close()
107+
except socket.error as e:
108+
if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
109+
obj.handle_error()
110+
else:
111+
obj.handle_close()
107112
except _reraised_exceptions:
108113
raise
109114
except:

0 commit comments

Comments
 (0)