mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix issue 6706: adds new handle_accepted() method to asyncore.dispatcher
This commit is contained in:
parent
4c94c53630
commit
977c707b42
10 changed files with 126 additions and 42 deletions
16
Lib/smtpd.py
16
Lib/smtpd.py
|
@ -421,21 +421,7 @@ class SMTPServer(asyncore.dispatcher):
|
|||
self.__class__.__name__, time.ctime(time.time()),
|
||||
localaddr, remoteaddr), file=DEBUGSTREAM)
|
||||
|
||||
def handle_accept(self):
|
||||
try:
|
||||
conn, addr = self.accept()
|
||||
except TypeError:
|
||||
# sometimes accept() might return None
|
||||
return
|
||||
except socket.error as err:
|
||||
# ECONNABORTED might be thrown
|
||||
if err.args[0] != errno.ECONNABORTED:
|
||||
raise
|
||||
return
|
||||
else:
|
||||
# sometimes addr == None instead of (ip, port)
|
||||
if addr == None:
|
||||
return
|
||||
def handle_accepted(self, conn, addr):
|
||||
print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM)
|
||||
channel = self.channel_class(self, conn, addr)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue