From f66e723866bad093c789f2061d1b4f75049c382b Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 9 Jun 2020 15:12:26 +0200 Subject: [PATCH] Fix Authorization server not properly stopping after flow completes. CURA-7490 --- cura/OAuth2/AuthorizationRequestServer.py | 3 ++- cura/OAuth2/LocalAuthorizationServer.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/OAuth2/AuthorizationRequestServer.py b/cura/OAuth2/AuthorizationRequestServer.py index 74b0b5f012..4ed3975638 100644 --- a/cura/OAuth2/AuthorizationRequestServer.py +++ b/cura/OAuth2/AuthorizationRequestServer.py @@ -2,6 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from http.server import HTTPServer +from socketserver import ThreadingMixIn from typing import Callable, Any, TYPE_CHECKING if TYPE_CHECKING: @@ -9,7 +10,7 @@ if TYPE_CHECKING: from cura.OAuth2.AuthorizationHelpers import AuthorizationHelpers -class AuthorizationRequestServer(HTTPServer): +class AuthorizationRequestServer(ThreadingMixIn, HTTPServer): """The authorization request callback handler server. This subclass is needed to be able to pass some data to the request handler. This cannot be done on the request diff --git a/cura/OAuth2/LocalAuthorizationServer.py b/cura/OAuth2/LocalAuthorizationServer.py index a41de2d406..0e017c5318 100644 --- a/cura/OAuth2/LocalAuthorizationServer.py +++ b/cura/OAuth2/LocalAuthorizationServer.py @@ -81,6 +81,7 @@ class LocalAuthorizationServer: if self._web_server: try: + self._web_server.shutdown() self._web_server.server_close() except OSError: # OS error can happen if the socket was already closed. We really don't care about that case.