mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Instantiate an RPCHandler per request.
RPCHandlers are pretty light objects and this allows us to pass in parameters like the InfoSub object without locking or adding more parameters to the RPC methods.
This commit is contained in:
@@ -45,16 +45,16 @@ Json::Value WSConnection::invokeCommand(Json::Value& jvRequest)
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
RPCHandler mRPCHandler(&mNetwork, this);
|
||||
Json::Value jvResult(Json::objectValue);
|
||||
|
||||
// Regular RPC command
|
||||
jvResult["result"] = theApp->getRPCHandler().doCommand(
|
||||
jvResult["result"] = mRPCHandler.doCommand(
|
||||
jvRequest["command"].asString(),
|
||||
jvRequest.isMember("params")
|
||||
? jvRequest["params"]
|
||||
: jvRequest,
|
||||
mHandler->getPublic() ? RPCHandler::GUEST : RPCHandler::ADMIN,
|
||||
this);
|
||||
mHandler->getPublic() ? RPCHandler::GUEST : RPCHandler::ADMIN);
|
||||
|
||||
// Currently we will simply unwrap errors returned by the RPC
|
||||
// API, in the future maybe we can make the responses
|
||||
|
||||
Reference in New Issue
Block a user