Changeset View
Changeset View
Standalone View
Standalone View
src/httprpc.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | RPCTimerBase *NewTimer(std::function<void(void)> &func, | ||||
return new HTTPRPCTimer(base, func, millis); | return new HTTPRPCTimer(base, func, millis); | ||||
} | } | ||||
private: | private: | ||||
struct event_base *base; | struct event_base *base; | ||||
}; | }; | ||||
/* Stored RPC timer interface (for unregistration) */ | /* Stored RPC timer interface (for unregistration) */ | ||||
static HTTPRPCTimerInterface *httpRPCTimerInterface = 0; | static HTTPRPCTimerInterface *httpRPCTimerInterface = nullptr; | ||||
static void JSONErrorReply(HTTPRequest *req, const UniValue &objError, | static void JSONErrorReply(HTTPRequest *req, const UniValue &objError, | ||||
const UniValue &id) { | const UniValue &id) { | ||||
// Send error reply from json-rpc error object. | // Send error reply from json-rpc error object. | ||||
int nStatus = HTTP_INTERNAL_SERVER_ERROR; | int nStatus = HTTP_INTERNAL_SERVER_ERROR; | ||||
int code = find_value(objError, "code").get_int(); | int code = find_value(objError, "code").get_int(); | ||||
if (code == RPC_INVALID_REQUEST) | if (code == RPC_INVALID_REQUEST) | ||||
▲ Show 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
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); | RPCUnsetTimerInterface(httpRPCTimerInterface); | ||||
delete httpRPCTimerInterface; | delete httpRPCTimerInterface; | ||||
httpRPCTimerInterface = 0; | httpRPCTimerInterface = nullptr; | ||||
} | } | ||||
} | } |