summaryrefslogtreecommitdiffstats
path: root/Lib/asyncore.py
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2010-10-04 21:08:36 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2010-10-04 21:08:36 (GMT)
commit977c707b425ee753d54f3e9010f07ec77ef61274 (patch)
tree580e12fd41103a684b4c24b53d43569eb69bc6a8 /Lib/asyncore.py
parent4c94c5363091350ed56bfbdbc6cc00e1048b456c (diff)
downloadcpython-977c707b425ee753d54f3e9010f07ec77ef61274.zip
cpython-977c707b425ee753d54f3e9010f07ec77ef61274.tar.gz
cpython-977c707b425ee753d54f3e9010f07ec77ef61274.tar.bz2
Fix issue 6706: adds new handle_accepted() method to asyncore.dispatcher
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r--Lib/asyncore.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index 8745276..a277bdd 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -352,12 +352,15 @@ class dispatcher:
# XXX can return either an address pair or None
try:
conn, addr = self.socket.accept()
- return conn, addr
+ except TypeError:
+ return None
except socket.error as why:
- if why.args[0] == EWOULDBLOCK:
- pass
+ if why.args[0] in (EWOULDBLOCK, ECONNABORTED):
+ return None
else:
raise
+ else:
+ return conn, addr
def send(self, data):
try:
@@ -506,7 +509,13 @@ class dispatcher:
self.log_info('unhandled connect event', 'warning')
def handle_accept(self):
- self.log_info('unhandled accept event', 'warning')
+ pair = self.accept()
+ if pair is not None:
+ self.handle_accepted(*pair)
+
+ def handle_accepted(self, sock, addr):
+ sock.close()
+ self.log_info('unhandled accepted event', 'warning')
def handle_close(self):
self.log_info('unhandled close event', 'warning')