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

Skip to content

Commit 2f95dc0

Browse files
committed
Merged revisions 88722 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r88722 | giampaolo.rodola | 2011-03-03 14:57:47 +0100 (gio, 03 mar 2011) | 1 line Fix issue 11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), recv() and send(). ........
1 parent 88f416e commit 2f95dc0

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

Lib/asyncore.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
import time
5353
import os
5454
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
55-
ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode
55+
ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, \
56+
EAGAIN, errorcode
57+
58+
_DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
59+
EBADF))
5660

5761
try:
5862
socket_map
@@ -107,7 +111,7 @@ def readwrite(obj, flags):
107111
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
108112
obj.handle_close()
109113
except socket.error as e:
110-
if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED):
114+
if e.args[0] not in _DISCONNECTED:
111115
obj.handle_error()
112116
else:
113117
obj.handle_close()
@@ -349,7 +353,7 @@ def accept(self):
349353
except TypeError:
350354
return None
351355
except socket.error as why:
352-
if why.args[0] in (EWOULDBLOCK, ECONNABORTED):
356+
if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
353357
return None
354358
else:
355359
raise

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Core and Builtins
3737
Library
3838
-------
3939

40+
- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors
41+
on accept(), send() and recv().
42+
4043
- Issue #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers
4144
larger than 4GB. Patch by Nadeem Vawda.
4245

0 commit comments

Comments
 (0)