mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
New MasterLockType which tracks ownership
This commit is contained in:
@@ -972,9 +972,6 @@
|
|||||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_RandomNumbers.h">
|
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_RandomNumbers.h">
|
||||||
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_ScopedLock.h">
|
|
||||||
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_StringUtilities.h">
|
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_StringUtilities.h">
|
||||||
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1692,6 +1689,9 @@
|
|||||||
<ClInclude Include="..\..\modules\ripple_app\node\ripple_MdbBackendFactory.h">
|
<ClInclude Include="..\..\modules\ripple_app\node\ripple_MdbBackendFactory.h">
|
||||||
<Filter>[1] Ripple\ripple_app\node</Filter>
|
<Filter>[1] Ripple\ripple_app\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_ScopedLock.h">
|
||||||
|
<Filter>[1] Ripple\ripple_basics\utility</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" />
|
<CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" />
|
||||||
|
|||||||
@@ -155,10 +155,10 @@ namespace ripple
|
|||||||
#include "src/cpp/ripple/TransactionMaster.h"
|
#include "src/cpp/ripple/TransactionMaster.h"
|
||||||
#include "src/cpp/ripple/ripple_LocalCredentials.h"
|
#include "src/cpp/ripple/ripple_LocalCredentials.h"
|
||||||
#include "src/cpp/ripple/WSDoor.h"
|
#include "src/cpp/ripple/WSDoor.h"
|
||||||
|
#include "src/cpp/ripple/ripple_Application.h"
|
||||||
#include "src/cpp/ripple/RPCHandler.h"
|
#include "src/cpp/ripple/RPCHandler.h"
|
||||||
#include "src/cpp/ripple/TransactionQueue.h"
|
#include "src/cpp/ripple/TransactionQueue.h"
|
||||||
#include "ledger/OrderBookDB.h"
|
#include "ledger/OrderBookDB.h"
|
||||||
#include "src/cpp/ripple/ripple_Application.h"
|
|
||||||
#include "src/cpp/ripple/CallRPC.h"
|
#include "src/cpp/ripple/CallRPC.h"
|
||||||
#include "src/cpp/ripple/Transactor.h"
|
#include "src/cpp/ripple/Transactor.h"
|
||||||
#include "src/cpp/ripple/ChangeTransactor.h"
|
#include "src/cpp/ripple/ChangeTransactor.h"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A class that unlocks on construction and locks on destruction
|
// A class that unlocks on construction and locks on destruction
|
||||||
|
/*
|
||||||
class ScopedUnlock
|
class ScopedUnlock
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -80,5 +80,6 @@ private:
|
|||||||
ScopedUnlock (const ScopedUnlock&); // no implementation
|
ScopedUnlock (const ScopedUnlock&); // no implementation
|
||||||
ScopedUnlock& operator= (const ScopedUnlock&); // no implementation
|
ScopedUnlock& operator= (const ScopedUnlock&); // no implementation
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,8 +42,10 @@ NetworkOPs::NetworkOPs (LedgerMaster* pLedgerMaster)
|
|||||||
|
|
||||||
void NetworkOPs::processNetTimer ()
|
void NetworkOPs::processNetTimer ()
|
||||||
{
|
{
|
||||||
ScopedLock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
|
// VFALCO NOTE This is for diagnosing a crash on exit
|
||||||
Application& app (getApp ());
|
Application& app (getApp ());
|
||||||
ILoadManager& mgr (app.getLoadManager ());
|
ILoadManager& mgr (app.getLoadManager ());
|
||||||
|
|
||||||
@@ -86,6 +88,7 @@ void NetworkOPs::processNetTimer ()
|
|||||||
|
|
||||||
if (mConsensus)
|
if (mConsensus)
|
||||||
mConsensus->timerEntry ();
|
mConsensus->timerEntry ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
|
void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
|
||||||
@@ -309,7 +312,8 @@ void NetworkOPs::runTransactionQueue ()
|
|||||||
{
|
{
|
||||||
LoadEvent::autoptr ev = getApp().getJobQueue ().getLoadEventAP (jtTXN_PROC, "runTxnQ");
|
LoadEvent::autoptr ev = getApp().getJobQueue ().getLoadEventAP (jtTXN_PROC, "runTxnQ");
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
Transaction::pointer dbtx = getApp().getMasterTransaction ().fetch (txn->getID (), true);
|
Transaction::pointer dbtx = getApp().getMasterTransaction ().fetch (txn->getID (), true);
|
||||||
assert (dbtx);
|
assert (dbtx);
|
||||||
@@ -321,8 +325,8 @@ void NetworkOPs::runTransactionQueue ()
|
|||||||
|
|
||||||
if (isTemMalformed (r)) // malformed, cache bad
|
if (isTemMalformed (r)) // malformed, cache bad
|
||||||
getApp().getHashRouter ().setFlag (txn->getID (), SF_BAD);
|
getApp().getHashRouter ().setFlag (txn->getID (), SF_BAD);
|
||||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||||
// getApp().getHashRouter ().setFlag (txn->getID (), SF_RETRY);
|
// getApp().getHashRouter ().setFlag (txn->getID (), SF_RETRY);
|
||||||
|
|
||||||
|
|
||||||
if (isTerRetry (r))
|
if (isTerRetry (r))
|
||||||
@@ -351,10 +355,9 @@ void NetworkOPs::runTransactionQueue ()
|
|||||||
dbtx->setStatus (INVALID);
|
dbtx->setStatus (INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (didApply || (mMode != omFULL))
|
if (didApply /*|| (mMode != omFULL)*/ )
|
||||||
if (didApply)
|
|
||||||
{
|
{
|
||||||
std::set<uint64> peers;
|
std::set <uint64> peers;
|
||||||
|
|
||||||
if (getApp().getHashRouter ().swapSet (txn->getID (), peers, SF_RELAYED))
|
if (getApp().getHashRouter ().swapSet (txn->getID (), peers, SF_RELAYED))
|
||||||
{
|
{
|
||||||
@@ -376,6 +379,7 @@ void NetworkOPs::runTransactionQueue ()
|
|||||||
txn->doCallbacks (r);
|
txn->doCallbacks (r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getApp().getTxnQueue ().stopProcessing (txn))
|
if (getApp().getTxnQueue ().stopProcessing (txn))
|
||||||
getApp().getIOService ().post (BIND_TYPE (&NetworkOPs::runTransactionQueue, this));
|
getApp().getIOService ().post (BIND_TYPE (&NetworkOPs::runTransactionQueue, this));
|
||||||
@@ -410,7 +414,9 @@ Transaction::pointer NetworkOPs::processTransaction (Transaction::pointer trans,
|
|||||||
getApp().getHashRouter ().setFlag (trans->getID (), SF_SIGGOOD);
|
getApp().getHashRouter ().setFlag (trans->getID (), SF_SIGGOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
bool didApply;
|
bool didApply;
|
||||||
TER r = mLedgerMaster->doTransaction (trans->getSTransaction (),
|
TER r = mLedgerMaster->doTransaction (trans->getSTransaction (),
|
||||||
bAdmin ? (tapOPEN_LEDGER | tapNO_CHECK_SIGN | tapADMIN) : (tapOPEN_LEDGER | tapNO_CHECK_SIGN), didApply);
|
bAdmin ? (tapOPEN_LEDGER | tapNO_CHECK_SIGN | tapADMIN) : (tapOPEN_LEDGER | tapNO_CHECK_SIGN), didApply);
|
||||||
@@ -418,11 +424,10 @@ Transaction::pointer NetworkOPs::processTransaction (Transaction::pointer trans,
|
|||||||
|
|
||||||
if (isTemMalformed (r)) // malformed, cache bad
|
if (isTemMalformed (r)) // malformed, cache bad
|
||||||
getApp().getHashRouter ().setFlag (trans->getID (), SF_BAD);
|
getApp().getHashRouter ().setFlag (trans->getID (), SF_BAD);
|
||||||
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
// else if (isTelLocal (r) || isTerRetry (r)) // can be retried
|
||||||
// getApp().getHashRouter ().setFlag (trans->getID (), SF_RETRY);
|
// getApp().getHashRouter ().setFlag (trans->getID (), SF_RETRY);
|
||||||
|
|
||||||
#ifdef BEAST_DEBUG
|
#ifdef BEAST_DEBUG
|
||||||
|
|
||||||
if (r != tesSUCCESS)
|
if (r != tesSUCCESS)
|
||||||
{
|
{
|
||||||
std::string token, human;
|
std::string token, human;
|
||||||
@@ -483,6 +488,7 @@ Transaction::pointer NetworkOPs::processTransaction (Transaction::pointer trans,
|
|||||||
getApp().getPeers ().relayMessageBut (peers, packet);
|
getApp().getPeers ().relayMessageBut (peers, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
@@ -958,7 +964,8 @@ uint256 NetworkOPs::getConsensusLCL ()
|
|||||||
void NetworkOPs::processTrustedProposal (LedgerProposal::pointer proposal,
|
void NetworkOPs::processTrustedProposal (LedgerProposal::pointer proposal,
|
||||||
boost::shared_ptr<protocol::TMProposeSet> set, RippleAddress nodePublic, uint256 checkLedger, bool sigGood)
|
boost::shared_ptr<protocol::TMProposeSet> set, RippleAddress nodePublic, uint256 checkLedger, bool sigGood)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
bool relay = true;
|
bool relay = true;
|
||||||
|
|
||||||
@@ -1000,7 +1007,10 @@ void NetworkOPs::processTrustedProposal (LedgerProposal::pointer proposal,
|
|||||||
getApp().getPeers ().relayMessageBut (peers, message);
|
getApp().getPeers ().relayMessageBut (peers, message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
|
WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMap::pointer NetworkOPs::getTXMap (uint256 const& hash)
|
SHAMap::pointer NetworkOPs::getTXMap (uint256 const& hash)
|
||||||
@@ -1042,8 +1052,10 @@ SHAMapAddNode NetworkOPs::gotTXData (const boost::shared_ptr<Peer>& peer, uint25
|
|||||||
{
|
{
|
||||||
|
|
||||||
boost::shared_ptr<LedgerConsensus> consensus;
|
boost::shared_ptr<LedgerConsensus> consensus;
|
||||||
|
|
||||||
{
|
{
|
||||||
ScopedLock mlh(getApp().getMasterLock());
|
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
consensus = mConsensus;
|
consensus = mConsensus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ RPCHandler::RPCHandler (NetworkOPs* netOps, InfoSub::pointer infoSub) : mNetOps
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool bFailHard, ScopedLock& mlh)
|
Json::Value RPCHandler::transactionSign (Json::Value params, bool bSubmit, bool bFailHard, Application::ScopedLockType& mlh)
|
||||||
{
|
{
|
||||||
if (getApp().getFeeTrack().isLoadedCluster() && (mRole != ADMIN))
|
if (getApp().getFeeTrack().isLoadedCluster() && (mRole != ADMIN))
|
||||||
return rpcError(rpcTOO_BUSY);
|
return rpcError(rpcTOO_BUSY);
|
||||||
@@ -595,7 +595,7 @@ Json::Value RPCHandler::accountFromString (Ledger::ref lrLedger, RippleAddress&
|
|||||||
// ledger_hash : <ledger>
|
// ledger_hash : <ledger>
|
||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -640,7 +640,7 @@ Json::Value RPCHandler::doAccountInfo (Json::Value params, LoadType* loadType, S
|
|||||||
// port: <number>
|
// port: <number>
|
||||||
// }
|
// }
|
||||||
// XXX Might allow domain for manual connections.
|
// XXX Might allow domain for manual connections.
|
||||||
Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (theConfig.RUN_STANDALONE)
|
if (theConfig.RUN_STANDALONE)
|
||||||
return "cannot connect in standalone mode";
|
return "cannot connect in standalone mode";
|
||||||
@@ -661,7 +661,7 @@ Json::Value RPCHandler::doConnect (Json::Value params, LoadType* loadType, Scope
|
|||||||
// {
|
// {
|
||||||
// key: <string>
|
// key: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("key"))
|
if (!params.isMember ("key"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -687,7 +687,7 @@ Json::Value RPCHandler::doDataDelete (Json::Value params, LoadType* loadType, Sc
|
|||||||
// {
|
// {
|
||||||
// key: <string>
|
// key: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("key"))
|
if (!params.isMember ("key"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -711,7 +711,7 @@ Json::Value RPCHandler::doDataFetch (Json::Value params, LoadType* loadType, Sco
|
|||||||
// key: <string>
|
// key: <string>
|
||||||
// value: <string>
|
// value: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doDataStore (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doDataStore (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("key")
|
if (!params.isMember ("key")
|
||||||
|| !params.isMember ("value"))
|
|| !params.isMember ("value"))
|
||||||
@@ -772,7 +772,7 @@ Json::Value RPCHandler::doNicknameInfo (Json::Value params)
|
|||||||
// 'account_index' : <index> // optional
|
// 'account_index' : <index> // optional
|
||||||
// }
|
// }
|
||||||
// XXX This would be better if it took the ledger.
|
// XXX This would be better if it took the ledger.
|
||||||
Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("account") && !params.isMember ("ident"))
|
if (!params.isMember ("account") && !params.isMember ("ident"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -797,7 +797,7 @@ Json::Value RPCHandler::doOwnerInfo (Json::Value params, LoadType* loadType, Sco
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value jvResult (Json::objectValue);
|
Json::Value jvResult (Json::objectValue);
|
||||||
|
|
||||||
@@ -808,7 +808,7 @@ Json::Value RPCHandler::doPeers (Json::Value, LoadType* loadType, ScopedLock& Ma
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
return Json::Value (Json::objectValue);
|
return Json::Value (Json::objectValue);
|
||||||
}
|
}
|
||||||
@@ -818,7 +818,7 @@ Json::Value RPCHandler::doPing (Json::Value, LoadType* loadType, ScopedLock& Mas
|
|||||||
// issuer is the offering account
|
// issuer is the offering account
|
||||||
// --> submit: 'submit|true|false': defaults to false
|
// --> submit: 'submit|true|false': defaults to false
|
||||||
// Prior to running allow each to have a credit line of what they will be getting from the other account.
|
// Prior to running allow each to have a credit line of what they will be getting from the other account.
|
||||||
Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
/* need to fix now that sharedOfferCreate is gone
|
/* need to fix now that sharedOfferCreate is gone
|
||||||
int iArgs = params.size();
|
int iArgs = params.size();
|
||||||
@@ -910,9 +910,9 @@ Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Scope
|
|||||||
// difficulty: <number> // optional
|
// difficulty: <number> // optional
|
||||||
// secret: <secret> // optional
|
// secret: <secret> // optional
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
// XXX: Add ability to create proof with arbitrary time
|
// XXX: Add ability to create proof with arbitrary time
|
||||||
|
|
||||||
Json::Value jvResult (Json::objectValue);
|
Json::Value jvResult (Json::objectValue);
|
||||||
@@ -955,9 +955,9 @@ Json::Value RPCHandler::doProofCreate (Json::Value params, LoadType* loadType, S
|
|||||||
// {
|
// {
|
||||||
// token: <token>
|
// token: <token>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
|
|
||||||
@@ -985,9 +985,9 @@ Json::Value RPCHandler::doProofSolve (Json::Value params, LoadType* loadType, Sc
|
|||||||
// difficulty: <number> // optional
|
// difficulty: <number> // optional
|
||||||
// secret: <secret> // optional
|
// secret: <secret> // optional
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
// XXX Add ability to check proof against arbitrary time
|
// XXX Add ability to check proof against arbitrary time
|
||||||
|
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
@@ -1055,7 +1055,7 @@ Json::Value RPCHandler::doProofVerify (Json::Value params, LoadType* loadType, S
|
|||||||
// ledger_hash : <ledger>
|
// ledger_hash : <ledger>
|
||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -1067,7 +1067,7 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType,
|
|||||||
|
|
||||||
if (lpLedger->isImmutable ())
|
if (lpLedger->isImmutable ())
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
bUnlocked = true;
|
bUnlocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,7 +1140,7 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!bUnlocked)
|
if (!bUnlocked)
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1168,7 +1168,7 @@ static void offerAdder (Json::Value& jvLines, SLE::ref offer)
|
|||||||
// ledger_hash : <ledger>
|
// ledger_hash : <ledger>
|
||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -1180,7 +1180,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
|||||||
|
|
||||||
if (lpLedger->isImmutable ())
|
if (lpLedger->isImmutable ())
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
bUnlocked = true;
|
bUnlocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
|||||||
lpLedger->visitAccountItems (raAccount.getAccountID (), BIND_TYPE (&offerAdder, boost::ref (jvsOffers), P_1));
|
lpLedger->visitAccountItems (raAccount.getAccountID (), BIND_TYPE (&offerAdder, boost::ref (jvsOffers), P_1));
|
||||||
|
|
||||||
if (!bUnlocked)
|
if (!bUnlocked)
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
@@ -1227,7 +1227,7 @@ Json::Value RPCHandler::doAccountOffers (Json::Value params, LoadType* loadType,
|
|||||||
// "limit" : integer, // Optional.
|
// "limit" : integer, // Optional.
|
||||||
// "proof" : boolean // Defaults to false.
|
// "proof" : boolean // Defaults to false.
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (getApp().getJobQueue ().getJobCountGE (jtCLIENT) > 200)
|
if (getApp().getJobQueue ().getJobCountGE (jtCLIENT) > 200)
|
||||||
{
|
{
|
||||||
@@ -1241,7 +1241,7 @@ Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Sc
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
|
|
||||||
if (lpLedger->isImmutable ())
|
if (lpLedger->isImmutable ())
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
if (!params.isMember ("taker_pays") || !params.isMember ("taker_gets") || !params["taker_pays"].isObject () || !params["taker_gets"].isObject ())
|
if (!params.isMember ("taker_pays") || !params.isMember ("taker_gets") || !params["taker_pays"].isObject () || !params["taker_gets"].isObject ())
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -1328,9 +1328,9 @@ Json::Value RPCHandler::doBookOffers (Json::Value params, LoadType* loadType, Sc
|
|||||||
// {
|
// {
|
||||||
// random: <uint256>
|
// random: <uint256>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
uint256 uRandom;
|
uint256 uRandom;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -1349,7 +1349,7 @@ Json::Value RPCHandler::doRandom (Json::Value params, LoadType* loadType, Scoped
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("subcommand") || !params["subcommand"].isString ())
|
if (!params.isMember ("subcommand") || !params["subcommand"].isString ())
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -1404,7 +1404,7 @@ Json::Value RPCHandler::doPathFind (Json::Value params, LoadType* loadType, Scop
|
|||||||
// - Allows clients to verify path exists.
|
// - Allows clients to verify path exists.
|
||||||
// - Return canonicalized path.
|
// - Return canonicalized path.
|
||||||
// - From a trusted server, allows clients to use path without manipulation.
|
// - From a trusted server, allows clients to use path without manipulation.
|
||||||
Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);
|
int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);
|
||||||
|
|
||||||
@@ -1487,7 +1487,7 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType
|
|||||||
*loadType = LT_RPCBurden;
|
*loadType = LT_RPCBurden;
|
||||||
Ledger::pointer lSnapShot = boost::make_shared<Ledger> (boost::ref (*lpLedger), false);
|
Ledger::pointer lSnapShot = boost::make_shared<Ledger> (boost::ref (*lpLedger), false);
|
||||||
|
|
||||||
MasterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
|
masterLockHolder.unlock (); // As long as we have a locked copy of the ledger, we can unlock.
|
||||||
|
|
||||||
// Fill in currencies destination will accept
|
// Fill in currencies destination will accept
|
||||||
Json::Value jvDestCur (Json::arrayValue);
|
Json::Value jvDestCur (Json::arrayValue);
|
||||||
@@ -1636,23 +1636,23 @@ Json::Value RPCHandler::doRipplePathFind (Json::Value params, LoadType* loadType
|
|||||||
// tx_json: <object>,
|
// tx_json: <object>,
|
||||||
// secret: <secret>
|
// secret: <secret>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doSign (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doSign (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
*loadType = LT_RPCBurden;
|
*loadType = LT_RPCBurden;
|
||||||
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
||||||
return transactionSign (params, false, bFailHard, MasterLockHolder);
|
return transactionSign (params, false, bFailHard, masterLockHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// tx_json: <object>,
|
// tx_json: <object>,
|
||||||
// secret: <secret>
|
// secret: <secret>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("tx_blob"))
|
if (!params.isMember ("tx_blob"))
|
||||||
{
|
{
|
||||||
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
bool bFailHard = params.isMember ("fail_hard") && params["fail_hard"].asBool ();
|
||||||
return transactionSign (params, true, bFailHard, MasterLockHolder);
|
return transactionSign (params, true, bFailHard, masterLockHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
@@ -1710,7 +1710,7 @@ Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Scoped
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1740,7 +1740,7 @@ Json::Value RPCHandler::doSubmit (Json::Value params, LoadType* loadType, Scoped
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value ret (Json::objectValue);
|
Json::Value ret (Json::objectValue);
|
||||||
|
|
||||||
@@ -1749,7 +1749,7 @@ Json::Value RPCHandler::doConsensusInfo (Json::Value, LoadType* loadType, Scoped
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value ret (Json::objectValue);
|
Json::Value ret (Json::objectValue);
|
||||||
|
|
||||||
@@ -1758,7 +1758,7 @@ Json::Value RPCHandler::doServerInfo (Json::Value, LoadType* loadType, ScopedLoc
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value ret (Json::objectValue);
|
Json::Value ret (Json::objectValue);
|
||||||
|
|
||||||
@@ -1770,9 +1770,9 @@ Json::Value RPCHandler::doServerState (Json::Value, LoadType* loadType, ScopedLo
|
|||||||
// {
|
// {
|
||||||
// start: <index>
|
// start: <index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
if (!params.isMember ("start"))
|
if (!params.isMember ("start"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -1807,7 +1807,7 @@ Json::Value RPCHandler::doTxHistory (Json::Value params, LoadType* loadType, Sco
|
|||||||
// {
|
// {
|
||||||
// transaction: <hex>
|
// transaction: <hex>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("transaction"))
|
if (!params.isMember ("transaction"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -1873,7 +1873,7 @@ Json::Value RPCHandler::doTx (Json::Value params, LoadType* loadType, ScopedLock
|
|||||||
return rpcError (rpcNOT_IMPL);
|
return rpcError (rpcNOT_IMPL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
|
|
||||||
@@ -1886,7 +1886,7 @@ Json::Value RPCHandler::doLedgerClosed (Json::Value, LoadType* loadType, ScopedL
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
|
|
||||||
@@ -1900,7 +1900,7 @@ Json::Value RPCHandler::doLedgerCurrent (Json::Value, LoadType* loadType, Scoped
|
|||||||
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
||||||
// full: true | false // optional, defaults to false.
|
// full: true | false // optional, defaults to false.
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("ledger") && !params.isMember ("ledger_hash") && !params.isMember ("ledger_index"))
|
if (!params.isMember ("ledger") && !params.isMember ("ledger_hash") && !params.isMember ("ledger_index"))
|
||||||
{
|
{
|
||||||
@@ -1922,7 +1922,7 @@ Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Scoped
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
|
|
||||||
if (lpLedger->isImmutable ())
|
if (lpLedger->isImmutable ())
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
bool bFull = params.isMember ("full") && params["full"].asBool ();
|
bool bFull = params.isMember ("full") && params["full"].asBool ();
|
||||||
bool bTransactions = params.isMember ("transactions") && params["transactions"].asBool ();
|
bool bTransactions = params.isMember ("transactions") && params["transactions"].asBool ();
|
||||||
@@ -1949,7 +1949,7 @@ Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Scoped
|
|||||||
// offset: integer, // optional, defaults to 0
|
// offset: integer, // optional, defaults to 0
|
||||||
// limit: integer // optional
|
// limit: integer // optional
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
RippleAddress raAccount;
|
RippleAddress raAccount;
|
||||||
uint32 offset = params.isMember ("offset") ? params["offset"].asUInt () : 0;
|
uint32 offset = params.isMember ("offset") ? params["offset"].asUInt () : 0;
|
||||||
@@ -2018,7 +2018,7 @@ Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loa
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
Json::Value ret (Json::objectValue);
|
Json::Value ret (Json::objectValue);
|
||||||
|
|
||||||
@@ -2094,7 +2094,7 @@ Json::Value RPCHandler::doAccountTransactions (Json::Value params, LoadType* loa
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// This command requires admin access because it makes no sense to ask an untrusted server for this.
|
// This command requires admin access because it makes no sense to ask an untrusted server for this.
|
||||||
Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
RippleAddress raSeed;
|
RippleAddress raSeed;
|
||||||
Json::Value obj (Json::objectValue);
|
Json::Value obj (Json::objectValue);
|
||||||
@@ -2120,7 +2120,7 @@ Json::Value RPCHandler::doValidationCreate (Json::Value params, LoadType* loadTy
|
|||||||
// {
|
// {
|
||||||
// secret: <string>
|
// secret: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doValidationSeed (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doValidationSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value obj (Json::objectValue);
|
Json::Value obj (Json::objectValue);
|
||||||
|
|
||||||
@@ -2191,7 +2191,7 @@ Json::Value RPCHandler::accounts (Ledger::ref lrLedger, const RippleAddress& naM
|
|||||||
// ledger_hash : <ledger>
|
// ledger_hash : <ledger>
|
||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -2234,7 +2234,7 @@ Json::Value RPCHandler::doWalletAccounts (Json::Value params, LoadType* loadType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
return Log::rotateLog ();
|
return Log::rotateLog ();
|
||||||
}
|
}
|
||||||
@@ -2242,9 +2242,9 @@ Json::Value RPCHandler::doLogRotate (Json::Value, LoadType* loadType, ScopedLock
|
|||||||
// {
|
// {
|
||||||
// passphrase: <string>
|
// passphrase: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
RippleAddress naSeed;
|
RippleAddress naSeed;
|
||||||
RippleAddress naAccount;
|
RippleAddress naAccount;
|
||||||
@@ -2274,7 +2274,7 @@ Json::Value RPCHandler::doWalletPropose (Json::Value params, LoadType* loadType,
|
|||||||
// {
|
// {
|
||||||
// secret: <string>
|
// secret: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
RippleAddress raSeed;
|
RippleAddress raSeed;
|
||||||
bool bSecret = params.isMember ("secret");
|
bool bSecret = params.isMember ("secret");
|
||||||
@@ -2313,7 +2313,7 @@ Json::Value RPCHandler::doWalletSeed (Json::Value params, LoadType* loadType, Sc
|
|||||||
// username: <string>,
|
// username: <string>,
|
||||||
// password: <string>
|
// password: <string>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doLogin (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLogin (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("username")
|
if (!params.isMember ("username")
|
||||||
|| !params.isMember ("password"))
|
|| !params.isMember ("password"))
|
||||||
@@ -2351,7 +2351,7 @@ static void textTime (std::string& text, int& seconds, const char* unitName, int
|
|||||||
text += "s";
|
text += "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, ScopedLock& mlh)
|
Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("feature"))
|
if (!params.isMember ("feature"))
|
||||||
{
|
{
|
||||||
@@ -2380,7 +2380,7 @@ Json::Value RPCHandler::doFeature (Json::Value params, LoadType* loadType, Scope
|
|||||||
// {
|
// {
|
||||||
// min_count: <number> // optional, defaults to 10
|
// min_count: <number> // optional, defaults to 10
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
int minCount = 10;
|
int minCount = 10;
|
||||||
|
|
||||||
@@ -2432,7 +2432,7 @@ Json::Value RPCHandler::doGetCounts (Json::Value params, LoadType* loadType, Sco
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
// log_level
|
// log_level
|
||||||
if (!params.isMember ("severity"))
|
if (!params.isMember ("severity"))
|
||||||
@@ -2485,7 +2485,7 @@ Json::Value RPCHandler::doLogLevel (Json::Value params, LoadType* loadType, Scop
|
|||||||
// node: <domain>|<node_public>,
|
// node: <domain>|<node_public>,
|
||||||
// comment: <comment> // optional
|
// comment: <comment> // optional
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
std::string strNode = params.isMember ("node") ? params["node"].asString () : "";
|
std::string strNode = params.isMember ("node") ? params["node"].asString () : "";
|
||||||
std::string strComment = params.isMember ("comment") ? params["comment"].asString () : "";
|
std::string strComment = params.isMember ("comment") ? params["comment"].asString () : "";
|
||||||
@@ -2509,7 +2509,7 @@ Json::Value RPCHandler::doUnlAdd (Json::Value params, LoadType* loadType, Scoped
|
|||||||
// {
|
// {
|
||||||
// node: <domain>|<public_key>
|
// node: <domain>|<public_key>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("node"))
|
if (!params.isMember ("node"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -2532,7 +2532,7 @@ Json::Value RPCHandler::doUnlDelete (Json::Value params, LoadType* loadType, Sco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value obj (Json::objectValue);
|
Json::Value obj (Json::objectValue);
|
||||||
|
|
||||||
@@ -2542,7 +2542,7 @@ Json::Value RPCHandler::doUnlList (Json::Value, LoadType* loadType, ScopedLock&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Populate the UNL from a local validators.txt file.
|
// Populate the UNL from a local validators.txt file.
|
||||||
Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (theConfig.VALIDATORS_FILE.empty () || !getApp().getUNL ().nodeLoad (theConfig.VALIDATORS_FILE))
|
if (theConfig.VALIDATORS_FILE.empty () || !getApp().getUNL ().nodeLoad (theConfig.VALIDATORS_FILE))
|
||||||
{
|
{
|
||||||
@@ -2554,7 +2554,7 @@ Json::Value RPCHandler::doUnlLoad (Json::Value, LoadType* loadType, ScopedLock&
|
|||||||
|
|
||||||
|
|
||||||
// Populate the UNL from ripple.com's validators.txt file.
|
// Populate the UNL from ripple.com's validators.txt file.
|
||||||
Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
getApp().getUNL ().nodeNetwork ();
|
getApp().getUNL ().nodeNetwork ();
|
||||||
|
|
||||||
@@ -2562,7 +2562,7 @@ Json::Value RPCHandler::doUnlNetwork (Json::Value params, LoadType* loadType, Sc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unl_reset
|
// unl_reset
|
||||||
Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
getApp().getUNL ().nodeReset ();
|
getApp().getUNL ().nodeReset ();
|
||||||
|
|
||||||
@@ -2570,14 +2570,14 @@ Json::Value RPCHandler::doUnlReset (Json::Value params, LoadType* loadType, Scop
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unl_score
|
// unl_score
|
||||||
Json::Value RPCHandler::doUnlScore (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnlScore (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
getApp().getUNL ().nodeScore ();
|
getApp().getUNL ().nodeScore ();
|
||||||
|
|
||||||
return "scoring requested";
|
return "scoring requested";
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
if (!params.isMember ("text"))
|
if (!params.isMember ("text"))
|
||||||
return rpcError (rpcINVALID_PARAMS);
|
return rpcError (rpcINVALID_PARAMS);
|
||||||
@@ -2586,14 +2586,14 @@ Json::Value RPCHandler::doSMS (Json::Value params, LoadType* loadType, ScopedLoc
|
|||||||
|
|
||||||
return "sms dispatched";
|
return "sms dispatched";
|
||||||
}
|
}
|
||||||
Json::Value RPCHandler::doStop (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doStop (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
getApp().stop ();
|
getApp().stop ();
|
||||||
|
|
||||||
return SYSTEM_NAME " server stopping";
|
return SYSTEM_NAME " server stopping";
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
|
|
||||||
@@ -2616,7 +2616,7 @@ Json::Value RPCHandler::doLedgerAccept (Json::Value, LoadType* loadType, ScopedL
|
|||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
// XXX In this case, not specify either ledger does not mean ledger current. It means any ledger.
|
// XXX In this case, not specify either ledger does not mean ledger current. It means any ledger.
|
||||||
Json::Value RPCHandler::doTransactionEntry (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doTransactionEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -2785,7 +2785,7 @@ Json::Value RPCHandler::lookupLedger (Json::Value params, Ledger::pointer& lpLed
|
|||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -2794,7 +2794,7 @@ Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, S
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
|
|
||||||
if (lpLedger->isImmutable ())
|
if (lpLedger->isImmutable ())
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
uint256 uNodeIndex;
|
uint256 uNodeIndex;
|
||||||
bool bNodeBinary = false;
|
bool bNodeBinary = false;
|
||||||
@@ -2998,7 +2998,7 @@ Json::Value RPCHandler::doLedgerEntry (Json::Value params, LoadType* loadType, S
|
|||||||
// ledger_hash : <ledger>
|
// ledger_hash : <ledger>
|
||||||
// ledger_index : <ledger_index>
|
// ledger_index : <ledger_index>
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doLedgerHeader (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doLedgerHeader (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
Ledger::pointer lpLedger;
|
Ledger::pointer lpLedger;
|
||||||
Json::Value jvResult = lookupLedger (params, lpLedger);
|
Json::Value jvResult = lookupLedger (params, lpLedger);
|
||||||
@@ -3040,7 +3040,7 @@ boost::unordered_set<RippleAddress> RPCHandler::parseAccountIds (const Json::Val
|
|||||||
return usnaResult;
|
return usnaResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
InfoSub::pointer ispSub;
|
InfoSub::pointer ispSub;
|
||||||
Json::Value jvResult (Json::objectValue);
|
Json::Value jvResult (Json::objectValue);
|
||||||
@@ -3332,7 +3332,7 @@ Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, Sco
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This leaks RPCSub objects for JSON-RPC. Shouldn't matter for anyone sane.
|
// FIXME: This leaks RPCSub objects for JSON-RPC. Shouldn't matter for anyone sane.
|
||||||
Json::Value RPCHandler::doUnsubscribe (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doUnsubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
InfoSub::pointer ispSub;
|
InfoSub::pointer ispSub;
|
||||||
Json::Value jvResult (Json::objectValue);
|
Json::Value jvResult (Json::objectValue);
|
||||||
@@ -3554,7 +3554,7 @@ Json::Value RPCHandler::doRpcCommand (const std::string& strMethod, Json::Value
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RPCHandler::doInternal (Json::Value params, LoadType* loadType, ScopedLock& MasterLockHolder)
|
Json::Value RPCHandler::doInternal (Json::Value params, LoadType* loadType, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
// Used for debug or special-purpose RPC commands
|
// Used for debug or special-purpose RPC commands
|
||||||
if (!params.isMember ("internal_command"))
|
if (!params.isMember ("internal_command"))
|
||||||
@@ -3676,7 +3676,8 @@ Json::Value RPCHandler::doCommand (const Json::Value& params, int iRole, LoadTyp
|
|||||||
return rpcError (rpcNO_PERMISSION);
|
return rpcError (rpcNO_PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedLock MasterLockHolder (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
if ((commandsA[i].iOptions & optNetwork) && (mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
|
if ((commandsA[i].iOptions & optNetwork) && (mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
|
||||||
{
|
{
|
||||||
@@ -3697,7 +3698,7 @@ Json::Value RPCHandler::doCommand (const Json::Value& params, int iRole, LoadTyp
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Json::Value jvRaw = (this->* (commandsA[i].dfpFunc)) (params, loadType, MasterLockHolder);
|
Json::Value jvRaw = (this->* (commandsA[i].dfpFunc)) (params, loadType, lock);
|
||||||
|
|
||||||
// Regularize result.
|
// Regularize result.
|
||||||
if (jvRaw.isObject ())
|
if (jvRaw.isObject ())
|
||||||
@@ -3725,6 +3726,7 @@ Json::Value RPCHandler::doCommand (const Json::Value& params, int iRole, LoadTyp
|
|||||||
return rpcError (rpcINTERNAL);
|
return rpcError (rpcINTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RPCInternalHandler* RPCInternalHandler::sHeadHandler = NULL;
|
RPCInternalHandler* RPCInternalHandler::sHeadHandler = NULL;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ private:
|
|||||||
typedef Json::Value (RPCHandler::*doFuncPtr) (
|
typedef Json::Value (RPCHandler::*doFuncPtr) (
|
||||||
Json::Value params,
|
Json::Value params,
|
||||||
LoadType* loadType,
|
LoadType* loadType,
|
||||||
ScopedLock& MasterLockHolder);
|
Application::ScopedLockType& MasterLockHolder);
|
||||||
|
|
||||||
// VFALCO TODO Document these and give the enumeration a label.
|
// VFALCO TODO Document these and give the enumeration a label.
|
||||||
enum
|
enum
|
||||||
@@ -57,7 +57,7 @@ private:
|
|||||||
|
|
||||||
boost::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
|
boost::unordered_set <RippleAddress> parseAccountIds (const Json::Value& jvArray);
|
||||||
|
|
||||||
Json::Value transactionSign (Json::Value jvRequest, bool bSubmit, bool bFailHard, ScopedLock& mlh);
|
Json::Value transactionSign (Json::Value jvRequest, bool bSubmit, bool bFailHard, Application::ScopedLockType& mlh);
|
||||||
|
|
||||||
Json::Value lookupLedger (Json::Value jvRequest, Ledger::pointer& lpLedger);
|
Json::Value lookupLedger (Json::Value jvRequest, Ledger::pointer& lpLedger);
|
||||||
|
|
||||||
@@ -89,70 +89,70 @@ private:
|
|||||||
const int iIndex,
|
const int iIndex,
|
||||||
const bool bStrict);
|
const bool bStrict);
|
||||||
|
|
||||||
Json::Value doAccountInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doAccountInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doAccountLines (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doAccountLines (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doAccountOffers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doAccountOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doAccountTransactions (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doAccountTransactions (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doBookOffers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doBookOffers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doConnect (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doConnect (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doConsensusInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doConsensusInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doFeature (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doFeature (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doGetCounts (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doGetCounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doInternal (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doInternal (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedger (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedger (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedgerAccept (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedgerAccept (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedgerClosed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedgerClosed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedgerCurrent (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedgerCurrent (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedgerEntry (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedgerEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLedgerHeader (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLedgerHeader (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLogLevel (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLogLevel (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLogRotate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLogRotate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doNicknameInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doNicknameInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doOwnerInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doOwnerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doPathFind (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doPathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doPeers (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doPeers (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doPing (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doPing (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doProfile (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doProfile (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doProofCreate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doProofCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doProofSolve (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doProofSolve (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doProofVerify (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doProofVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doRandom (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doRandom (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doRipplePathFind (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doRipplePathFind (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doSMS (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSMS (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doServerInfo (Json::Value params, LoadType* loadType, ScopedLock& mlh); // for humans
|
Json::Value doServerInfo (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh); // for humans
|
||||||
Json::Value doServerState (Json::Value params, LoadType* loadType, ScopedLock& mlh); // for machines
|
Json::Value doServerState (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh); // for machines
|
||||||
Json::Value doSessionClose (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSessionClose (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doSessionOpen (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSessionOpen (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doSign (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSign (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doStop (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doStop (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doSubmit (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSubmit (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doSubscribe (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doSubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doTransactionEntry (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doTransactionEntry (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doTx (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doTx (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doTxHistory (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doTxHistory (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlAdd (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlAdd (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlDelete (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlFetch (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlList (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlList (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlLoad (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlLoad (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlNetwork (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlNetwork (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlReset (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlReset (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnlScore (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnlScore (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doUnsubscribe (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doUnsubscribe (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doValidationCreate (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doValidationCreate (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doValidationSeed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doValidationSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletAccounts (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletAccounts (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletLock (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletLock (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletPropose (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletPropose (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletSeed (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletSeed (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletUnlock (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletUnlock (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doWalletVerify (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doWalletVerify (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
|
|
||||||
#if ENABLE_INSECURE
|
#if ENABLE_INSECURE
|
||||||
Json::Value doDataDelete (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doDataDelete (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doDataFetch (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doDataFetch (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doDataStore (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doDataStore (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
Json::Value doLogin (Json::Value params, LoadType* loadType, ScopedLock& mlh);
|
Json::Value doLogin (Json::Value params, LoadType* loadType, Application::ScopedLockType& mlh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
, mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
|
, mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
|
||||||
, mIOWork (mIOService)
|
, mIOWork (mIOService)
|
||||||
, mNetOps (&mLedgerMaster)
|
, mNetOps (new NetworkOPs (&mLedgerMaster))
|
||||||
, m_rpcServerHandler (mNetOps)
|
, m_rpcServerHandler (*mNetOps)
|
||||||
, mTempNodeCache ("NodeCache", 16384, 90)
|
, mTempNodeCache ("NodeCache", 16384, 90)
|
||||||
, m_nodeStore (NodeStore::New (
|
, m_nodeStore (NodeStore::New (
|
||||||
theConfig.NODE_DB,
|
theConfig.NODE_DB,
|
||||||
@@ -84,6 +84,8 @@ public:
|
|||||||
|
|
||||||
~ApplicationImp ()
|
~ApplicationImp ()
|
||||||
{
|
{
|
||||||
|
mNetOps = nullptr;
|
||||||
|
|
||||||
// VFALCO TODO Wrap these in ScopedPointer
|
// VFALCO TODO Wrap these in ScopedPointer
|
||||||
delete mTxnDB;
|
delete mTxnDB;
|
||||||
delete mLedgerDB;
|
delete mLedgerDB;
|
||||||
@@ -97,7 +99,7 @@ public:
|
|||||||
|
|
||||||
NetworkOPs& getOPs ()
|
NetworkOPs& getOPs ()
|
||||||
{
|
{
|
||||||
return mNetOps;
|
return *mNetOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::io_service& getIOService ()
|
boost::asio::io_service& getIOService ()
|
||||||
@@ -135,7 +137,7 @@ public:
|
|||||||
return mJobQueue;
|
return mJobQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::recursive_mutex& getMasterLock ()
|
MasterLockType& getMasterLock ()
|
||||||
{
|
{
|
||||||
return mMasterLock;
|
return mMasterLock;
|
||||||
}
|
}
|
||||||
@@ -261,13 +263,13 @@ private:
|
|||||||
//
|
//
|
||||||
boost::asio::io_service::work mIOWork;
|
boost::asio::io_service::work mIOWork;
|
||||||
|
|
||||||
boost::recursive_mutex mMasterLock;
|
MasterLockType mMasterLock;
|
||||||
|
|
||||||
LocalCredentials m_localCredentials;
|
LocalCredentials m_localCredentials;
|
||||||
LedgerMaster mLedgerMaster;
|
LedgerMaster mLedgerMaster;
|
||||||
InboundLedgers m_inboundLedgers;
|
InboundLedgers m_inboundLedgers;
|
||||||
TransactionMaster mMasterTransaction;
|
TransactionMaster mMasterTransaction;
|
||||||
NetworkOPs mNetOps;
|
ScopedPointer <NetworkOPs> mNetOps;
|
||||||
RPCServerHandler m_rpcServerHandler;
|
RPCServerHandler m_rpcServerHandler;
|
||||||
NodeCache mTempNodeCache;
|
NodeCache mTempNodeCache;
|
||||||
ScopedPointer <NodeStore> m_nodeStore;
|
ScopedPointer <NodeStore> m_nodeStore;
|
||||||
@@ -441,7 +443,7 @@ void ApplicationImp::setup ()
|
|||||||
{
|
{
|
||||||
// This should probably become the default once we have a stable network
|
// This should probably become the default once we have a stable network
|
||||||
if (!theConfig.RUN_STANDALONE)
|
if (!theConfig.RUN_STANDALONE)
|
||||||
mNetOps.needNetworkLedger ();
|
mNetOps->needNetworkLedger ();
|
||||||
|
|
||||||
startNewLedger ();
|
startNewLedger ();
|
||||||
}
|
}
|
||||||
@@ -572,13 +574,13 @@ void ApplicationImp::setup ()
|
|||||||
{
|
{
|
||||||
WriteLog (lsWARNING, Application) << "Running in standalone mode";
|
WriteLog (lsWARNING, Application) << "Running in standalone mode";
|
||||||
|
|
||||||
mNetOps.setStandAlone ();
|
mNetOps->setStandAlone ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// VFALCO NOTE the state timer resets the deadlock detector.
|
// VFALCO NOTE the state timer resets the deadlock detector.
|
||||||
//
|
//
|
||||||
mNetOps.setStateTimer ();
|
mNetOps->setStateTimer ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,8 +655,8 @@ void ApplicationImp::doSweep(Job& j)
|
|||||||
mSLECache.sweep ();
|
mSLECache.sweep ();
|
||||||
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
||||||
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
||||||
mNetOps.sweepFetchPack ();
|
mNetOps->sweepFetchPack ();
|
||||||
|
// VFALCO NOTE does the call to sweep() happen on another thread?
|
||||||
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
||||||
mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this));
|
mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this));
|
||||||
}
|
}
|
||||||
@@ -685,7 +687,7 @@ void ApplicationImp::startNewLedger ()
|
|||||||
secondLedger->setAccepted ();
|
secondLedger->setAccepted ();
|
||||||
mLedgerMaster.pushLedger (secondLedger, boost::make_shared<Ledger> (true, boost::ref (*secondLedger)), false);
|
mLedgerMaster.pushLedger (secondLedger, boost::make_shared<Ledger> (true, boost::ref (*secondLedger)), false);
|
||||||
assert (!!secondLedger->getAccountState (rootAddress));
|
assert (!!secondLedger->getAccountState (rootAddress));
|
||||||
mNetOps.setLastCloseTime (secondLedger->getCloseTimeNC ());
|
mNetOps->setLastCloseTime (secondLedger->getCloseTimeNC ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +755,7 @@ bool ApplicationImp::loadOldLedger (const std::string& l, bool bReplay)
|
|||||||
Ledger::pointer openLedger = boost::make_shared<Ledger> (false, boost::ref (*loadLedger));
|
Ledger::pointer openLedger = boost::make_shared<Ledger> (false, boost::ref (*loadLedger));
|
||||||
mLedgerMaster.switchLedgers (loadLedger, openLedger);
|
mLedgerMaster.switchLedgers (loadLedger, openLedger);
|
||||||
mLedgerMaster.forceValid(loadLedger);
|
mLedgerMaster.forceValid(loadLedger);
|
||||||
mNetOps.setLastCloseTime (loadLedger->getCloseTimeNC ());
|
mNetOps->setLastCloseTime (loadLedger->getCloseTimeNC ());
|
||||||
|
|
||||||
if (bReplay)
|
if (bReplay)
|
||||||
{ // inject transaction from replayLedger into consensus set
|
{ // inject transaction from replayLedger into consensus set
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ typedef TaggedCache <uint256, SerializedLedgerEntry, UptimeTimerAdapter> SLECach
|
|||||||
class Application
|
class Application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Application () { }
|
|
||||||
|
|
||||||
/* VFALCO NOTE
|
/* VFALCO NOTE
|
||||||
|
|
||||||
The master lock protects:
|
The master lock protects:
|
||||||
@@ -51,7 +49,110 @@ public:
|
|||||||
|
|
||||||
other things
|
other things
|
||||||
*/
|
*/
|
||||||
virtual boost::recursive_mutex& getMasterLock () = 0;
|
#if 1
|
||||||
|
class ScopedLockType;
|
||||||
|
|
||||||
|
class MasterLockType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MasterLockType ()
|
||||||
|
: m_fileName ("")
|
||||||
|
, m_lineNumber (0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note that these are not exactly thread safe.
|
||||||
|
|
||||||
|
char const* getFileName () const noexcept
|
||||||
|
{
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getLineNumber () const noexcept
|
||||||
|
{
|
||||||
|
return m_lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class ScopedLockType;
|
||||||
|
|
||||||
|
void setOwner (char const* fileName, int lineNumber)
|
||||||
|
{
|
||||||
|
m_fileName = fileName;
|
||||||
|
m_lineNumber = lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetOwner ()
|
||||||
|
{
|
||||||
|
m_fileName = "";
|
||||||
|
m_lineNumber = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::recursive_mutex m_mutex;
|
||||||
|
char const* m_fileName;
|
||||||
|
int m_lineNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ScopedLockType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ScopedLockType (MasterLockType& mutex,
|
||||||
|
char const* fileName,
|
||||||
|
int lineNumber)
|
||||||
|
: m_mutex (mutex)
|
||||||
|
, m_lock (mutex.m_mutex)
|
||||||
|
{
|
||||||
|
mutex.setOwner (fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedLockType ()
|
||||||
|
{
|
||||||
|
if (m_lock.owns_lock ())
|
||||||
|
m_mutex.resetOwner ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlock ()
|
||||||
|
{
|
||||||
|
if (m_lock.owns_lock ())
|
||||||
|
m_mutex.resetOwner ();
|
||||||
|
|
||||||
|
m_lock.unlock ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
MasterLockType& m_mutex;
|
||||||
|
boost::recursive_mutex::scoped_lock m_lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
typedef boost::recursive_mutex MasterLockType;
|
||||||
|
|
||||||
|
typedef boost::recursive_mutex::scoped_lock ScopedLockType;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
virtual MasterLockType& getMasterLock () = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct State
|
||||||
|
{
|
||||||
|
// Stuff in here is accessed concurrently and requires a WriteAccess
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef SharedData <State> SharedState;
|
||||||
|
|
||||||
|
SharedState& getSharedState () noexcept { return m_sharedState; }
|
||||||
|
|
||||||
|
SharedState const& getSharedState () const noexcept { return m_sharedState; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SharedState m_sharedState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~Application () { }
|
||||||
|
|
||||||
virtual boost::asio::io_service& getIOService () = 0;
|
virtual boost::asio::io_service& getIOService () = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1179,7 +1179,9 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer)
|
|||||||
if (set->getHash ().isNonZero ()) // put our set where others can get it later
|
if (set->getHash ().isNonZero ()) // put our set where others can get it later
|
||||||
getApp().getOPs ().takePosition (mPreviousLedger->getLedgerSeq (), set);
|
getApp().getOPs ().takePosition (mPreviousLedger->getLedgerSeq (), set);
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock masterLock (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
assert (set->getHash () == mOurPosition->getCurrentHash ());
|
assert (set->getHash () == mOurPosition->getCurrentHash ());
|
||||||
|
|
||||||
getApp().getOPs ().peekStoredProposals ().clear (); // these are now obsolete
|
getApp().getOPs ().peekStoredProposals ().clear (); // these are now obsolete
|
||||||
@@ -1327,7 +1329,7 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer)
|
|||||||
WriteLog (lsINFO, LedgerConsensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")";
|
WriteLog (lsINFO, LedgerConsensus) << "Our close offset is estimated at " << offset << " (" << closeCount << ")";
|
||||||
getApp().getOPs ().closeTimeOffset (offset);
|
getApp().getOPs ().closeTimeOffset (offset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerConsensus::endConsensus ()
|
void LedgerConsensus::endConsensus ()
|
||||||
|
|||||||
@@ -250,6 +250,11 @@ private:
|
|||||||
static void logDeadlock (int dlTime)
|
static void logDeadlock (int dlTime)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LoadManager) << "Server stalled for " << dlTime << " seconds.";
|
WriteLog (lsWARNING, LoadManager) << "Server stalled for " << dlTime << " seconds.";
|
||||||
|
|
||||||
|
char const* fileName = getApp ().getMasterLock ().getFileName ();
|
||||||
|
int lineNumber = getApp ().getMasterLock ().getLineNumber ();
|
||||||
|
|
||||||
|
WriteLog (lsWARNING, LoadManager) << "Master lock owned by " << File (fileName).getFileName ().toStdString () << ", line " << lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -165,12 +165,12 @@ private:
|
|||||||
|
|
||||||
void recvHello (protocol::TMHello & packet);
|
void recvHello (protocol::TMHello & packet);
|
||||||
void recvCluster (protocol::TMCluster & packet);
|
void recvCluster (protocol::TMCluster & packet);
|
||||||
void recvTransaction (protocol::TMTransaction & packet, ScopedLock & MasterLockHolder);
|
void recvTransaction (protocol::TMTransaction & packet, Application::ScopedLockType& masterLockHolder);
|
||||||
void recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, ScopedLock & MasterLockHolder);
|
void recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, Application::ScopedLockType& masterLockHolder);
|
||||||
void recvGetValidation (protocol::TMGetValidations & packet);
|
void recvGetValidation (protocol::TMGetValidations & packet);
|
||||||
void recvContact (protocol::TMContact & packet);
|
void recvContact (protocol::TMContact & packet);
|
||||||
void recvGetContacts (protocol::TMGetContacts & packet);
|
void recvGetContacts (protocol::TMGetContacts & packet);
|
||||||
void recvGetPeers (protocol::TMGetPeers & packet, ScopedLock & MasterLockHolder);
|
void recvGetPeers (protocol::TMGetPeers & packet, Application::ScopedLockType& masterLockHolder);
|
||||||
void recvPeers (protocol::TMPeers & packet);
|
void recvPeers (protocol::TMPeers & packet);
|
||||||
void recvGetObjectByHash (const boost::shared_ptr<protocol::TMGetObjectByHash>& packet);
|
void recvGetObjectByHash (const boost::shared_ptr<protocol::TMGetObjectByHash>& packet);
|
||||||
void recvPing (protocol::TMPing & packet);
|
void recvPing (protocol::TMPing & packet);
|
||||||
@@ -178,8 +178,8 @@ private:
|
|||||||
void recvSearchTransaction (protocol::TMSearchTransaction & packet);
|
void recvSearchTransaction (protocol::TMSearchTransaction & packet);
|
||||||
void recvGetAccount (protocol::TMGetAccount & packet);
|
void recvGetAccount (protocol::TMGetAccount & packet);
|
||||||
void recvAccount (protocol::TMAccount & packet);
|
void recvAccount (protocol::TMAccount & packet);
|
||||||
void recvGetLedger (protocol::TMGetLedger & packet, ScopedLock & MasterLockHolder);
|
void recvGetLedger (protocol::TMGetLedger & packet, Application::ScopedLockType& masterLockHolder);
|
||||||
void recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet, ScopedLock & MasterLockHolder);
|
void recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet, Application::ScopedLockType& masterLockHolder);
|
||||||
void recvStatus (protocol::TMStatusChange & packet);
|
void recvStatus (protocol::TMStatusChange & packet);
|
||||||
void recvPropose (const boost::shared_ptr<protocol::TMProposeSet>& packet);
|
void recvPropose (const boost::shared_ptr<protocol::TMProposeSet>& packet);
|
||||||
void recvHaveTxSet (protocol::TMHaveTransactionSet & packet);
|
void recvHaveTxSet (protocol::TMHaveTransactionSet & packet);
|
||||||
@@ -630,8 +630,11 @@ void PeerImp::handleReadBody (const boost::system::error_code& error)
|
|||||||
WriteLog (lsINFO, Peer) << "Peer: Body: Error: " << getIP () << ": " << error.category ().name () << ": " << error.message () << ": " << error;
|
WriteLog (lsINFO, Peer) << "Peer: Body: Error: " << getIP () << ": " << error.category ().name () << ": " << error.message () << ": " << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
detach ("hrb", true);
|
detach ("hrb", true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,7 +654,8 @@ void PeerImp::processReadBuffer ()
|
|||||||
|
|
||||||
LoadEvent::autoptr event (getApp().getJobQueue ().getLoadEventAP (jtPEER, "PeerImp::read"));
|
LoadEvent::autoptr event (getApp().getJobQueue ().getLoadEventAP (jtPEER, "PeerImp::read"));
|
||||||
|
|
||||||
ScopedLock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
// If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent.
|
// If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent.
|
||||||
if (mHelloed == (type == protocol::mtHELLO))
|
if (mHelloed == (type == protocol::mtHELLO))
|
||||||
@@ -740,7 +744,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
protocol::TMGetPeers msg;
|
protocol::TMGetPeers msg;
|
||||||
|
|
||||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||||
recvGetPeers (msg, sl);
|
recvGetPeers (msg, lock);
|
||||||
else
|
else
|
||||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||||
}
|
}
|
||||||
@@ -800,7 +804,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
protocol::TMTransaction msg;
|
protocol::TMTransaction msg;
|
||||||
|
|
||||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||||
recvTransaction (msg, sl);
|
recvTransaction (msg, lock);
|
||||||
else
|
else
|
||||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||||
}
|
}
|
||||||
@@ -836,7 +840,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
protocol::TMGetLedger msg;
|
protocol::TMGetLedger msg;
|
||||||
|
|
||||||
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
if (msg.ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||||
recvGetLedger (msg, sl);
|
recvGetLedger (msg, lock);
|
||||||
else
|
else
|
||||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||||
}
|
}
|
||||||
@@ -848,7 +852,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
boost::shared_ptr<protocol::TMLedgerData> msg = boost::make_shared<protocol::TMLedgerData> ();
|
boost::shared_ptr<protocol::TMLedgerData> msg = boost::make_shared<protocol::TMLedgerData> ();
|
||||||
|
|
||||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||||
recvLedger (msg, sl);
|
recvLedger (msg, lock);
|
||||||
else
|
else
|
||||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||||
}
|
}
|
||||||
@@ -872,12 +876,12 @@ void PeerImp::processReadBuffer ()
|
|||||||
boost::shared_ptr<protocol::TMValidation> msg = boost::make_shared<protocol::TMValidation> ();
|
boost::shared_ptr<protocol::TMValidation> msg = boost::make_shared<protocol::TMValidation> ();
|
||||||
|
|
||||||
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
if (msg->ParseFromArray (&mReadbuf[PackedMessage::kHeaderBytes], mReadbuf.size () - PackedMessage::kHeaderBytes))
|
||||||
recvValidation (msg, sl);
|
recvValidation (msg, lock);
|
||||||
else
|
else
|
||||||
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
WriteLog (lsWARNING, Peer) << "parse error: " << type;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
case protocol::mtGET_VALIDATION:
|
case protocol::mtGET_VALIDATION:
|
||||||
{
|
{
|
||||||
@@ -890,7 +894,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case protocol::mtGET_OBJECTS:
|
case protocol::mtGET_OBJECTS:
|
||||||
{
|
{
|
||||||
@@ -923,6 +927,7 @@ void PeerImp::processReadBuffer ()
|
|||||||
WriteLog (lsWARNING, Peer) << strHex (&mReadbuf[0], mReadbuf.size ());
|
WriteLog (lsWARNING, Peer) << strHex (&mReadbuf[0], mReadbuf.size ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerImp::recvHello (protocol::TMHello& packet)
|
void PeerImp::recvHello (protocol::TMHello& packet)
|
||||||
@@ -1111,9 +1116,9 @@ static void checkTransaction (Job&, int flags, SerializedTransaction::pointer st
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerImp::recvTransaction (protocol::TMTransaction& packet, ScopedLock& MasterLockHolder)
|
void PeerImp::recvTransaction (protocol::TMTransaction& packet, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
Transaction::pointer tx;
|
Transaction::pointer tx;
|
||||||
#ifndef TRUST_NETWORK
|
#ifndef TRUST_NETWORK
|
||||||
|
|
||||||
@@ -1375,9 +1380,9 @@ static void checkValidation (Job&, SerializedValidation::pointer val, uint256 si
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerImp::recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, ScopedLock& MasterLockHolder)
|
void PeerImp::recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
|
|
||||||
if (packet->validation ().size () < 50)
|
if (packet->validation ().size () < 50)
|
||||||
{
|
{
|
||||||
@@ -1463,9 +1468,9 @@ void PeerImp::recvGetContacts (protocol::TMGetContacts& packet)
|
|||||||
// Return a list of your favorite people
|
// Return a list of your favorite people
|
||||||
// TODO: filter out all the LAN peers
|
// TODO: filter out all the LAN peers
|
||||||
// TODO: filter out the peer you are talking to
|
// TODO: filter out the peer you are talking to
|
||||||
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, ScopedLock& MasterLockHolder)
|
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
std::vector<std::string> addrs;
|
std::vector<std::string> addrs;
|
||||||
|
|
||||||
getApp().getPeers ().getTopNAddrs (30, addrs);
|
getApp().getPeers ().getTopNAddrs (30, addrs);
|
||||||
@@ -1779,7 +1784,7 @@ void PeerImp::recvStatus (protocol::TMStatusChange& packet)
|
|||||||
mMaxLedger = packet.lastseq ();
|
mMaxLedger = packet.lastseq ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLockHolder)
|
void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
SHAMap::pointer map;
|
SHAMap::pointer map;
|
||||||
protocol::TMLedgerData reply;
|
protocol::TMLedgerData reply;
|
||||||
@@ -1929,7 +1934,7 @@ void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ledger->isImmutable ())
|
if (ledger->isImmutable ())
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, Peer) << "Request for data from mutable ledger";
|
WriteLog (lsWARNING, Peer) << "Request for data from mutable ledger";
|
||||||
@@ -2063,9 +2068,9 @@ void PeerImp::recvGetLedger (protocol::TMGetLedger& packet, ScopedLock& MasterLo
|
|||||||
sendPacket (oPacket, true);
|
sendPacket (oPacket, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerImp::recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet_ptr, ScopedLock& MasterLockHolder)
|
void PeerImp::recvLedger (const boost::shared_ptr<protocol::TMLedgerData>& packet_ptr, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
MasterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
protocol::TMLedgerData& packet = *packet_ptr;
|
protocol::TMLedgerData& packet = *packet_ptr;
|
||||||
|
|
||||||
if (packet.nodes ().size () <= 0)
|
if (packet.nodes ().size () <= 0)
|
||||||
|
|||||||
@@ -822,6 +822,10 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternalNT (const SHAMapNode& id, uint2
|
|||||||
if (!getApp().running ())
|
if (!getApp().running ())
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
// These are for diagnosing a crash on exit
|
||||||
|
Application& app (getApp ());
|
||||||
|
NodeStore& nodeStore (app.getNodeStore ());
|
||||||
|
|
||||||
NodeObject::pointer obj (getApp().getNodeStore ().retrieve (hash));
|
NodeObject::pointer obj (getApp().getNodeStore ().retrieve (hash));
|
||||||
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
|
|||||||
@@ -18,9 +18,13 @@ TransactionAcquire::TransactionAcquire (uint256 const& hash) : PeerSet (hash, TX
|
|||||||
|
|
||||||
static void TACompletionHandler (uint256 hash, SHAMap::pointer map)
|
static void TACompletionHandler (uint256 hash, SHAMap::pointer map)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
{
|
||||||
|
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
getApp().getOPs ().mapComplete (hash, map);
|
getApp().getOPs ().mapComplete (hash, map);
|
||||||
|
|
||||||
getApp().getInboundLedgers ().dropLedger (hash);
|
getApp().getInboundLedgers ().dropLedger (hash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionAcquire::done ()
|
void TransactionAcquire::done ()
|
||||||
@@ -50,7 +54,7 @@ void TransactionAcquire::onTimer (bool progress)
|
|||||||
{
|
{
|
||||||
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash ();
|
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash ();
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||||
|
|
||||||
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user