Issue #12039: Now suppress spurious select.error raised on FreeBSD when the server (an asyncore.dispatcher) is closed.

This commit is contained in:
Vinay Sajip 2011-05-10 07:48:28 +01:00
parent 00bc6ccb78
commit e73afad50f
1 changed files with 8 additions and 1 deletions

View File

@ -723,7 +723,14 @@ class TestSMTPServer(smtpd.SMTPServer):
:func:`select` or :func:`poll` call by
:func:`asyncore.loop`.
"""
asyncore.loop(poll_interval, map=self.sockmap)
try:
asyncore.loop(poll_interval, map=self.sockmap)
except select.error:
# On FreeBSD 8, closing the server repeatably
# raises this error. We swallow it if the
# server has been closed.
if self.connected or self.accepting:
raise
def stop(self, timeout=None):
"""