Reduce scope of RPC locks and general cleanup (RIPD-458)

This commit is contained in:
Tom Ritchford
2014-07-17 16:36:54 -04:00
parent 58547f6997
commit 4096fcd1bf
70 changed files with 860 additions and 619 deletions

View File

@@ -26,20 +26,26 @@ namespace ripple {
// }
Json::Value doUnlAdd (RPC::Context& context)
{
std::string strNode = context.params_.isMember ("node") ? context.params_["node"].asString () : "";
std::string strComment = context.params_.isMember ("comment") ? context.params_["comment"].asString () : "";
auto lock = getApp().masterLock();
std::string strNode = context.params_.isMember ("node")
? context.params_["node"].asString () : "";
std::string strComment = context.params_.isMember ("comment")
? context.params_["comment"].asString () : "";
RippleAddress raNodePublic;
if (raNodePublic.setNodePublic (strNode))
{
getApp().getUNL ().nodeAddPublic (raNodePublic, UniqueNodeList::vsManual, strComment);
getApp().getUNL ().nodeAddPublic (
raNodePublic, UniqueNodeList::vsManual, strComment);
return "adding node by public key";
}
else
{
getApp().getUNL ().nodeAddDomain (strNode, UniqueNodeList::vsManual, strComment);
getApp().getUNL ().nodeAddDomain (
strNode, UniqueNodeList::vsManual, strComment);
return "adding node by domain";
}