1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-12-29 09:21:51 +01:00

standalone: cleanup start/stop challenge

stop_challenge should only stop the server if the thread is still alive
This commit is contained in:
Kishi85 2019-04-04 12:44:38 +02:00
parent e12abbc3cb
commit 762037c42d

View File

@ -67,13 +67,14 @@ class ChallengeHandler(HTTPChallengeHandler):
del self.challenges[token]
def start_challenge(self, domain, thumbprint, token):
def _():
def _serve():
self.server.serve_forever()
self.server_thread = threading.Thread(target=_)
self.server_thread = threading.Thread(target=_serve)
self.server_thread.start()
HTTPChallengeHandler.start_challenge(self, domain, thumbprint, token)
def stop_challenge(self, domain, thumbprint, token):
self.server.shutdown()
self.server_thread.join()
if self.server_thread.is_alive():
self.server.shutdown()
self.server_thread.join()