Avoid server from blocking if an exception is found in the main thread

This commit is contained in:
Braulio Valdivielso Martínez
2015-12-02 02:02:09 +01:00
parent aac32ac56e
commit 5ecf789a6f
+5
View File
@@ -69,5 +69,10 @@ class Server(threading.Thread):
def __exit__(self, exc_type, exc_value, traceback):
if exc_type is None:
self.stop_event.wait()
else:
if self.wait_to_close_event:
# avoid server from blocking if an exception is found
# in the main thread
self.wait_to_close_event.set()
return False # allow exceptions to propagate