From 38194071c6c9aeaf2d585e93c101d4fa6498402a Mon Sep 17 00:00:00 2001 From: "jai.s" Date: Tue, 22 Sep 2020 16:11:25 +0530 Subject: [PATCH] Added condition for testmode in signal_handler and cookies condition in post method in api --- src/api.py | 9 +++++---- src/bitmessagemain.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api.py b/src/api.py index fab67029..d01ba4fb 100755 --- a/src/api.py +++ b/src/api.py @@ -90,12 +90,12 @@ class StoppableXMLRPCServer(SimpleXMLRPCServer): # pylint:disable=too-few-public-methods allow_reuse_address = True - def forever(self): + def serve_forever(self): """Start the SimpleXMLRPCServer""" # pylint: disable=arguments-differ while state.shutdown == 0: logger.error('before handle_request') - self.serve_forever() + self.handle_request() logger.error('After handle_request') @@ -165,7 +165,8 @@ class singleAPI(StoppableThread): apiNotifyPath) BMConfigParser().remove_option( 'bitmessagesettings', 'apinotifypath') - se.forever() + # se._stopped = False + se.serve_forever() class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): @@ -223,6 +224,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): self.end_headers() else: # got a valid XML RPC response + self.cookies = [] self.send_response(200) self.send_header("Content-type", "text/xml") self.send_header("Content-length", str(len(response))) @@ -1495,7 +1497,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): def _dispatch(self, method, params): # pylint: disable=attribute-defined-outside-init - self.cookies = [] validuser = self.APIAuthenticateClient() if not validuser: time.sleep(2) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 138d9b8e..e5a5a3ff 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -162,7 +162,7 @@ def signal_handler(signum, frame): logger.error("Got signal %i", signum) # there are possible non-UI variants to run bitmessage # which should shutdown especially test-mode - if state.thisapp.daemon or not state.enableGUI: + if state.thisapp.daemon or not state.enableGUI or state.testmode: shutdown.doCleanShutdown() else: print('# Thread: {}({})'.format(thread.name, thread.ident))