Locking fixes.

This commit is contained in:
JoelKatz
2012-11-20 15:20:43 -08:00
parent 0f010f0445
commit 8e520e8816
2 changed files with 17 additions and 7 deletions

View File

@@ -49,12 +49,15 @@ Json::Value WSConnection::invokeCommand(Json::Value& jvRequest)
Json::Value jvResult(Json::objectValue);
// Regular RPC command
jvResult["result"] = mRPCHandler.doCommand(
jvRequest["command"].asString(),
jvRequest.isMember("params")
? jvRequest["params"]
: jvRequest,
mHandler->getPublic() ? RPCHandler::GUEST : RPCHandler::ADMIN);
{
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
jvResult["result"] = mRPCHandler.doCommand(
jvRequest["command"].asString(),
jvRequest.isMember("params")
? jvRequest["params"]
: jvRequest,
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