From 8f08f8efb853cbdc5b1264a3fed712f629da6834 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 25 Oct 2015 00:09:33 -0400 Subject: [PATCH] Make sure httpd server stops after a certain time frame. --- service/crest.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/service/crest.py b/service/crest.py index 450204426..8d20af182 100644 --- a/service/crest.py +++ b/service/crest.py @@ -93,13 +93,18 @@ class Crest(): self.ssoTimer.stop() wx.CallAfter(pub.sendMessage, 'logout_success', message=None) + def stopServer(self): + self.httpd.stop() + self.httpdTimer.stop() + def startServer(self): thread.start_new_thread(self.httpd.serve, ()) + self.httpdTimer = RepeatedTimer(60, self.stopServer) + self.httpdTimer.start() self.state = str(uuid.uuid4()) return self.eve.auth_uri(scopes=self.scopes, state=self.state) def handleLogin(self, message): - self.httpd.stop() if not message: return @@ -147,5 +152,3 @@ class Crest(): wx.CallAfter(pub.sendMessage, 'login_success', type=1) - -