Issue #12151: Test now ignores datagram socket errors after server is closed.

This commit is contained in:
Vinay Sajip 2011-05-23 23:00:42 +01:00
parent 17ec7cd9ca
commit 3ef1229b14
1 changed files with 10 additions and 9 deletions

View File

@ -888,7 +888,8 @@ if threading:
before calling :meth:`start`, so that the server will
set up the socket and listen on it.
"""
def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True):
def __init__(self, addr, handler, poll_interval=0.5,
bind_and_activate=True):
class DelegatingUDPRequestHandler(DatagramRequestHandler):
def handle(self):
@ -896,15 +897,15 @@ if threading:
def finish(self):
data = self.wfile.getvalue()
if data:
try:
super(DelegatingUDPRequestHandler, self).finish()
except socket.error:
msg = ('Error during finish, while sending %r, '
'closed = %s')
print(msg % (data, self.server._closed), file=sys.stderr)
if not self.server._closed:
raise
ThreadingUDPServer.__init__(self, addr, DelegatingUDPRequestHandler,
ThreadingUDPServer.__init__(self, addr,
DelegatingUDPRequestHandler,
bind_and_activate)
ControlMixin.__init__(self, handler, poll_interval)
self._closed = False