Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2587,8 +2587,8 @@ def start(self, flag=None):
threading.Thread.start(self)

def run(self):
self.sock.settimeout(0.05)
self.sock.listen()
self.sock.settimeout(1.0)
self.sock.listen(5)
self.active = True
if self.flag:
# signal an event
Expand All @@ -2602,16 +2602,22 @@ def run(self):
handler = self.ConnectionHandler(self, newconn, connaddr)
handler.start()
handler.join()
except TimeoutError:
pass
except TimeoutError as e:
if support.verbose:
sys.stdout.write(f' connection timeout {e!r}\n')
except KeyboardInterrupt:
self.stop()
except BaseException as e:
if support.verbose and self.chatty:
sys.stdout.write(
' connection handling failed: ' + repr(e) + '\n')

self.sock.close()
self.close()

def close(self):
if self.sock is not None:
self.sock.close()
self.sock = None

def stop(self):
self.active = False
Expand Down