diff --git a/modules/ripple_app/ledger/ripple_InboundLedger.cpp b/modules/ripple_app/ledger/ripple_InboundLedger.cpp index e9101345dd..510c16624c 100644 --- a/modules/ripple_app/ledger/ripple_InboundLedger.cpp +++ b/modules/ripple_app/ledger/ripple_InboundLedger.cpp @@ -13,7 +13,7 @@ SETUP_LOG (InboundLedger) #define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive InboundLedger::InboundLedger (uint256 const& hash, uint32 seq) - : PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT) + : PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT, false) , mHaveBase (false) , mHaveState (false) , mHaveTransactions (false) diff --git a/modules/ripple_core/functional/ripple_Job.cpp b/modules/ripple_core/functional/ripple_Job.cpp index 18d6a6a162..3fa8ae36be 100644 --- a/modules/ripple_core/functional/ripple_Job.cpp +++ b/modules/ripple_core/functional/ripple_Job.cpp @@ -130,6 +130,9 @@ const char* Job::toString (JobType t) case jtTXN_PROC: return "processTransaction"; + case jtTXN_DATA: + return "fetchTxnData"; + case jtOB_SETUP: return "orderBookSetup"; diff --git a/modules/ripple_core/functional/ripple_Job.h b/modules/ripple_core/functional/ripple_Job.h index 66106f3e6e..1e97ee4ee0 100644 --- a/modules/ripple_core/functional/ripple_Job.h +++ b/modules/ripple_core/functional/ripple_Job.h @@ -17,20 +17,21 @@ enum JobType jtPUBOLDLEDGER = 2, // An old ledger has been accepted jtVALIDATION_ut = 3, // A validation from an untrusted source jtPROOFWORK = 4, // A proof of work demand from another server - jtPROPOSAL_ut = 5, // A proposal from an untrusted source - jtLEDGER_DATA = 6, // Received data for a ledger we're acquiring - jtUPDATE_PF = 7, // Update pathfinding requests - jtCLIENT = 8, // A websocket command from the client - jtTRANSACTION = 9, // A transaction received from the network - jtPUBLEDGER = 10, // Publish a fully-accepted ledger - jtWAL = 11, // Write-ahead logging - jtVALIDATION_t = 12, // A validation from a trusted source - jtWRITE = 13, // Write out hashed objects - jtTRANSACTION_l = 14, // A local transaction - jtPROPOSAL_t = 15, // A proposal from a trusted source - jtSWEEP = 16, // Sweep for stale structures - jtADMIN = 17, // An administrative operation - jtDEATH = 18, // job of death, used internally + jtTRANSACTION_l = 5, // A local transaction + jtPROPOSAL_ut = 6, // A proposal from an untrusted source + jtLEDGER_DATA = 7, // Received data for a ledger we're acquiring + jtUPDATE_PF = 8, // Update pathfinding requests + jtCLIENT = 9, // A websocket command from the client + jtTRANSACTION = 10, // A transaction received from the network + jtPUBLEDGER = 11, // Publish a fully-accepted ledger + jtTXN_DATA = 12, // Fetch a proposed set + jtWAL = 13, // Write-ahead logging + jtVALIDATION_t = 14, // A validation from a trusted source + jtWRITE = 15, // Write out hashed objects + jtPROPOSAL_t = 16, // A proposal from a trusted source + jtSWEEP = 17, // Sweep for stale structures + jtADMIN = 18, // An administrative operation + jtDEATH = 19, // job of death, used internally // special types not dispatched by the job pool jtPEER = 24, diff --git a/src/cpp/ripple/ripple_PeerSet.cpp b/src/cpp/ripple/ripple_PeerSet.cpp index 9f9f02b956..6698e55b1e 100644 --- a/src/cpp/ripple/ripple_PeerSet.cpp +++ b/src/cpp/ripple/ripple_PeerSet.cpp @@ -6,7 +6,7 @@ class InboundLedger; -PeerSet::PeerSet (uint256 const& hash, int interval) +PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData) : mHash (hash) , mTimerInterval (interval) , mTimeouts (0) @@ -14,6 +14,7 @@ PeerSet::PeerSet (uint256 const& hash, int interval) , mFailed (false) , mProgress (true) , mAggressive (false) + , mTxnData (txnData) , mTimer (getApp().getIOService ()) { mLastAction = UptimeTimer::getInstance ().getElapsedSeconds (); @@ -74,16 +75,24 @@ void PeerSet::TimerEntry (boost::weak_ptr wptr, const boost::system::er if (ptr) { - int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA); - - if (jc > 4) + if (ptr->mTxnData) { - WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load"; - ptr->setTimer (); + getApp().getJobQueue ().addLimitJob (jtTXN_DATA, "timerEntry", 2, + BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr)); } else - getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2, - BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr)); + { + int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA); + + if (jc > 4) + { + WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load"; + ptr->setTimer (); + } + else + getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2, + BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr)); + } } } diff --git a/src/cpp/ripple/ripple_PeerSet.h b/src/cpp/ripple/ripple_PeerSet.h index ba56da2c46..c0fd81bdb4 100644 --- a/src/cpp/ripple/ripple_PeerSet.h +++ b/src/cpp/ripple/ripple_PeerSet.h @@ -67,7 +67,7 @@ private: // VFALCO TODO try to make some of these private protected: - PeerSet (uint256 const& hash, int interval); + PeerSet (uint256 const& hash, int interval, bool txnData); virtual ~PeerSet () { } virtual void newPeer (Peer::ref) = 0; @@ -95,6 +95,7 @@ protected: bool mFailed; bool mProgress; bool mAggressive; + bool mTxnData; int mLastAction; diff --git a/src/cpp/ripple/ripple_TransactionAcquire.cpp b/src/cpp/ripple/ripple_TransactionAcquire.cpp index 6f4a020fc9..adb4e4fc1a 100644 --- a/src/cpp/ripple/ripple_TransactionAcquire.cpp +++ b/src/cpp/ripple/ripple_TransactionAcquire.cpp @@ -11,7 +11,9 @@ SETUP_LOG (TransactionAcquire) typedef std::map::value_type u160_prop_pair; typedef std::map::value_type u256_lct_pair; -TransactionAcquire::TransactionAcquire (uint256 const& hash) : PeerSet (hash, TX_ACQUIRE_TIMEOUT), mHaveRoot (false) +TransactionAcquire::TransactionAcquire (uint256 const& hash) + : PeerSet (hash, TX_ACQUIRE_TIMEOUT, true) + , mHaveRoot (false) { mMap = boost::make_shared (smtTRANSACTION, hash); }