From 5f7d28aeb60fb53ffa244f23b682ceb6dc8b938f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 27 Oct 2017 08:41:32 +0200 Subject: [PATCH] Only start termination process once We can't deal with the exception once we've started to shut down so make sure it's only raised once. --- websockify/websockifyserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websockify/websockifyserver.py b/websockify/websockifyserver.py index 2e115c7..b889114 100644 --- a/websockify/websockifyserver.py +++ b/websockify/websockifyserver.py @@ -343,6 +343,7 @@ class WebSockifyServer(object): self.launch_time = time.time() self.ws_connection = False self.handler_id = 1 + self.terminating = False self.logger = self.get_logger() self.tcp_keepalive = tcp_keepalive @@ -600,7 +601,9 @@ class WebSockifyServer(object): pass def terminate(self): - raise self.Terminate() + if not self.terminating: + self.terminating = True + raise self.Terminate() def multiprocessing_SIGCHLD(self, sig, stack): # TODO: figure out a way to actually log this information without