mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Use unique_ptr for httpRPCTimerInterface (HTTPRPCTimerInterface)
This commit is contained in:
parent
860e912583
commit
5a6f768896
@ -62,7 +62,7 @@ private:
|
|||||||
/* Pre-base64-encoded authentication token */
|
/* Pre-base64-encoded authentication token */
|
||||||
static std::string strRPCUserColonPass;
|
static std::string strRPCUserColonPass;
|
||||||
/* Stored RPC timer interface (for unregistration) */
|
/* Stored RPC timer interface (for unregistration) */
|
||||||
static HTTPRPCTimerInterface* httpRPCTimerInterface = nullptr;
|
static std::unique_ptr<HTTPRPCTimerInterface> httpRPCTimerInterface;
|
||||||
|
|
||||||
static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const UniValue& id)
|
static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const UniValue& id)
|
||||||
{
|
{
|
||||||
@ -238,8 +238,8 @@ bool StartHTTPRPC()
|
|||||||
RegisterHTTPHandler("/wallet/", false, HTTPReq_JSONRPC);
|
RegisterHTTPHandler("/wallet/", false, HTTPReq_JSONRPC);
|
||||||
#endif
|
#endif
|
||||||
assert(EventBase());
|
assert(EventBase());
|
||||||
httpRPCTimerInterface = new HTTPRPCTimerInterface(EventBase());
|
httpRPCTimerInterface = std::unique_ptr<HTTPRPCTimerInterface>(new HTTPRPCTimerInterface(EventBase()));
|
||||||
RPCSetTimerInterface(httpRPCTimerInterface);
|
RPCSetTimerInterface(httpRPCTimerInterface.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,8 +253,7 @@ 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.get());
|
||||||
delete httpRPCTimerInterface;
|
httpRPCTimerInterface.reset();
|
||||||
httpRPCTimerInterface = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user