refactor: Pass NodeContext to RPC and REST methods through util::Ref

This commit does not change behavior
This commit is contained in:
Russell Yanofsky
2020-04-17 11:28:45 -04:00
parent 691c817b34
commit 6fca33b2ed
17 changed files with 150 additions and 86 deletions

View File

@@ -783,16 +783,16 @@ static bool InitSanityCheck()
return true;
}
static bool AppInitServers()
static bool AppInitServers(const util::Ref& context)
{
RPCServer::OnStarted(&OnRPCStarted);
RPCServer::OnStopped(&OnRPCStopped);
if (!InitHTTPServer())
return false;
StartRPC();
if (!StartHTTPRPC())
if (!StartHTTPRPC(context))
return false;
if (gArgs.GetBoolArg("-rest", DEFAULT_REST_ENABLE)) StartREST();
if (gArgs.GetBoolArg("-rest", DEFAULT_REST_ENABLE)) StartREST(context);
StartHTTPServer();
return true;
}
@@ -1237,7 +1237,7 @@ bool AppInitLockDataDirectory()
return true;
}
bool AppInitMain(NodeContext& node)
bool AppInitMain(const util::Ref& context, NodeContext& node)
{
const CChainParams& chainparams = Params();
// ********************************************************* Step 4a: application initialization
@@ -1352,7 +1352,7 @@ bool AppInitMain(NodeContext& node)
if (gArgs.GetBoolArg("-server", false))
{
uiInterface.InitMessage_connect(SetRPCWarmupStatus);
if (!AppInitServers())
if (!AppInitServers(context))
return InitError(_("Unable to start HTTP server. See debug log for details."));
}