From 9992626438209cd199ffd7dd53788fd4b2db9e9e Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 22 Jul 2019 12:03:48 +0300 Subject: [PATCH] Fix API command 'shutdown' --- src/api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api.py b/src/api.py index 1e485209..d3e87dfd 100644 --- a/src/api.py +++ b/src/api.py @@ -204,6 +204,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): self.wfile.flush() self.connection.shutdown(1) + # actually handle shutdown command after sending response + if state.shutdown is False: + shutdown.doCleanShutdown() + def APIAuthenticateClient(self): """Predicate to check for valid API credentials in the request header""" @@ -1386,10 +1390,11 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): return None def HandleShutdown(self, params): - """Handle a request to huutdown the client""" + """Handle a request to shutdown the node""" if not params: - shutdown.doCleanShutdown() + # backward compatible trick because False == 0 is True + state.shutdown = False return 'done' return None