Init wot plugin
This commit is contained in:
parent
b2ebc56419
commit
3b8644fa8f
@ -62,7 +62,7 @@ def daemon():
|
|||||||
|
|
||||||
def _handle_sig_term(signum, frame):
|
def _handle_sig_term(signum, frame):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
with open(filepaths.pid_file, 'w') as f:
|
with open(filepaths.pid_file, 'w') as f:
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
|
|
||||||
@ -77,14 +77,15 @@ def daemon():
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"Onionr daemon is running under pid {os.getpid()}", terminal=True)
|
f"Onionr daemon is running under pid {os.getpid()}", terminal=True)
|
||||||
events.event('init', threaded=False)
|
events.event('init', threaded=False)
|
||||||
|
events.event('afterinit', threaded=False)
|
||||||
events.event('daemon_start')
|
events.event('daemon_start')
|
||||||
|
|
||||||
add_onionr_thread(
|
add_onionr_thread(
|
||||||
clean_block_database, 60, 'clean_block_database', initial_sleep=0)
|
clean_block_database, 60, 'clean_block_database', initial_sleep=0)
|
||||||
|
|
||||||
Thread(
|
Thread(
|
||||||
target=gossip.start_gossip_threads,
|
target=gossip.start_gossip_threads,
|
||||||
daemon=True,
|
daemon=True,
|
||||||
name='start_gossip_threads').start()
|
name='start_gossip_threads').start()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1 +1,7 @@
|
|||||||
plugin_apis = {}
|
#
|
||||||
|
from typing import Callable, Dict
|
||||||
|
|
||||||
|
# plugin apis are methods intended to be available to the rpc
|
||||||
|
# plugin, this is so plugins can provide apis to other plugins
|
||||||
|
# plugins add their methods during or before afterinit event
|
||||||
|
plugin_apis: Dict[str, Callable] = {}
|
@ -43,7 +43,7 @@ import ujson
|
|||||||
jsonrpc.manager.json = ujson
|
jsonrpc.manager.json = ujson
|
||||||
|
|
||||||
# RPC modules map Onionr APIs to the RPC dispacher
|
# RPC modules map Onionr APIs to the RPC dispacher
|
||||||
from rpc import blocks
|
from rpc import blocks, pluginrpcmethods
|
||||||
|
|
||||||
|
|
||||||
class OnionrRPC(object):
|
class OnionrRPC(object):
|
||||||
@ -57,6 +57,10 @@ class OnionrRPC(object):
|
|||||||
return response.json
|
return response.json
|
||||||
|
|
||||||
|
|
||||||
|
def on_afterinit(api, data=None):
|
||||||
|
pluginrpcmethods.add_plugin_rpc_methods()
|
||||||
|
|
||||||
|
|
||||||
def on_init(api, data=None):
|
def on_init(api, data=None):
|
||||||
config = {
|
config = {
|
||||||
#'server.socket_file': socket_file_path,
|
#'server.socket_file': socket_file_path,
|
||||||
@ -68,4 +72,3 @@ def on_init(api, data=None):
|
|||||||
add_onionr_thread(
|
add_onionr_thread(
|
||||||
cherrypy.quickstart, 5, 'OnionrRPCServer',
|
cherrypy.quickstart, 5, 'OnionrRPCServer',
|
||||||
OnionrRPC(), initial_sleep=0)
|
OnionrRPC(), initial_sleep=0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user