Changeset View
Changeset View
Standalone View
Standalone View
src/httprpc.cpp
Show First 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | const std::function<bool(Config &, HTTPRequest *, const std::string &)> | ||||
&httpRPCRequestProcessor, std::placeholders::_2); | &httpRPCRequestProcessor, std::placeholders::_2); | ||||
RegisterHTTPHandler("/", true, rpcFunction); | RegisterHTTPHandler("/", true, rpcFunction); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
// ifdef can be removed once we switch to better endpoint support and API | // ifdef can be removed once we switch to better endpoint support and API | ||||
// versioning | // versioning | ||||
RegisterHTTPHandler("/wallet/", false, rpcFunction); | RegisterHTTPHandler("/wallet/", false, rpcFunction); | ||||
#endif | #endif | ||||
assert(EventBase()); | assert(EventBase()); | ||||
httpRPCTimerInterface = std::unique_ptr<HTTPRPCTimerInterface>( | httpRPCTimerInterface = MakeUnique<HTTPRPCTimerInterface>(EventBase()); | ||||
new HTTPRPCTimerInterface(EventBase())); | |||||
RPCSetTimerInterface(httpRPCTimerInterface.get()); | RPCSetTimerInterface(httpRPCTimerInterface.get()); | ||||
return true; | return true; | ||||
} | } | ||||
void InterruptHTTPRPC() { | void InterruptHTTPRPC() { | ||||
LogPrint(BCLog::RPC, "Interrupting HTTP RPC server\n"); | LogPrint(BCLog::RPC, "Interrupting HTTP RPC server\n"); | ||||
} | } | ||||
void StopHTTPRPC() { | void StopHTTPRPC() { | ||||
LogPrint(BCLog::RPC, "Stopping HTTP RPC server\n"); | LogPrint(BCLog::RPC, "Stopping HTTP RPC server\n"); | ||||
UnregisterHTTPHandler("/", true); | UnregisterHTTPHandler("/", true); | ||||
if (httpRPCTimerInterface) { | if (httpRPCTimerInterface) { | ||||
RPCUnsetTimerInterface(httpRPCTimerInterface.get()); | RPCUnsetTimerInterface(httpRPCTimerInterface.get()); | ||||
httpRPCTimerInterface.reset(); | httpRPCTimerInterface.reset(); | ||||
} | } | ||||
} | } |