Add shutdown command to API

- calling "shutdown" now cleanly shuts down PyBitmessage, however the
call may not return so you need to add an error handler to the call.
With python for example, wrap the "shutdown()" in
"try:/except socket.error"
This commit is contained in:
Peter Šurda 2017-08-21 10:39:03 +02:00
parent b886f935d4
commit b7f808cde1
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -30,6 +30,7 @@ import protocol
import state
from pyelliptic.openssl import OpenSSL
import queues
import shutdown
from struct import pack
import network.stats
@ -982,6 +983,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
sqlStoredProcedure('deleteandvacuume')
return 'done'
def HandleShutdown(self, params):
shutdown.doCleanShutdown()
return 'done'
handlers = {}
handlers['helloWorld'] = HandleHelloWorld
handlers['add'] = HandleAdd
@ -1032,6 +1037,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
handlers['clientStatus'] = HandleClientStatus
handlers['decodeAddress'] = HandleDecodeAddress
handlers['deleteAndVacuum'] = HandleDeleteAndVacuum
handlers['shutdown'] = HandleShutdown
def _handle_request(self, method, params):
if (self.handlers.has_key(method)):