diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index bdceb63c4..7891b8dc9 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -1339,6 +1339,8 @@ void NetworkOPs::pubAcceptedTransaction(Ledger::ref lpCurrent, const SerializedT void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTransaction& stTxn, TER terResult, bool bAccepted, TransactionMetaSet::pointer& meta) { boost::unordered_set notify; + int iProposed = 0; + int iAccepted = 0; { boost::recursive_mutex::scoped_lock sl(mMonitorLock); @@ -1356,6 +1358,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr { BOOST_FOREACH(InfoSub* ispListener, simiIt->second) { + ++iProposed; notify.insert(ispListener); } } @@ -1368,6 +1371,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr { BOOST_FOREACH(InfoSub* ispListener, simiIt->second) { + ++iAccepted; notify.insert(ispListener); } } @@ -1375,6 +1379,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr } } } + cLog(lsINFO) << boost::str(boost::format("pubAccountTransaction: iProposed=%d iAccepted=%d") % iProposed % iAccepted); // FIXME: This can crash. An InfoSub can go away while we hold a regular pointer to it. if (!notify.empty()) @@ -1401,6 +1406,8 @@ void NetworkOPs::subAccount(InfoSub* ispListener, const boost::unordered_setinsertSubAccountInfo(naAccountID, uLedgerIndex); } diff --git a/src/cpp/ripple/ParseSection.cpp b/src/cpp/ripple/ParseSection.cpp index 839d3c85e..12bdded4b 100644 --- a/src/cpp/ripple/ParseSection.cpp +++ b/src/cpp/ripple/ParseSection.cpp @@ -1,4 +1,5 @@ #include "ParseSection.h" +#include "Log.h" #include "utils.h" #include @@ -7,6 +8,8 @@ #define SECTION_DEFAULT_NAME "" +SETUP_LOG(); + section ParseSection(const std::string& strInput, const bool bTrim) { std::string strData(strInput); @@ -113,6 +116,12 @@ bool sectionSingleB(section& secSource, const std::string& strSection, std::stri { strValue = (*pmtEntries)[0]; } + else if (pmtEntries) + { + cLog(lsWARNING) << boost::str(boost::format("Section [%s]: requires 1 line not %d lines.") + % strSection + % pmtEntries->size()); + } return bSingle; } diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 55ff10a56..dc0712efe 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -2401,10 +2401,14 @@ Json::Value RPCHandler::doSubscribe(Json::Value jvRequest) RPCSub *rspSub = mNetOps->findRpcSub(strUrl); if (!rspSub) { + cLog(lsINFO) << boost::str(boost::format("doSubscribe: building: %s") % strUrl); + rspSub = mNetOps->addRpcSub(strUrl, new RPCSub(strUrl, strUsername, strPassword)); } else { + cLog(lsINFO) << boost::str(boost::format("doSubscribe: reusing: %s") % strUrl); + if (jvRequest.isMember("username")) rspSub->setUsername(strUsername); @@ -2430,7 +2434,6 @@ Json::Value RPCHandler::doSubscribe(Json::Value jvRequest) if (streamName=="server") { mNetOps->subServer(ispSub, jvResult); - } else if (streamName=="ledger") { @@ -2483,6 +2486,8 @@ Json::Value RPCHandler::doSubscribe(Json::Value jvRequest) else { mNetOps->subAccount(ispSub, usnaAccoundIds, uLedgerIndex, false); + + cLog(lsINFO) << boost::str(boost::format("doSubscribe: accounts: %d") % usnaAccoundIds.size()); } } diff --git a/src/cpp/ripple/RPCSub.cpp b/src/cpp/ripple/RPCSub.cpp index 28daff00e..50dfb061f 100644 --- a/src/cpp/ripple/RPCSub.cpp +++ b/src/cpp/ripple/RPCSub.cpp @@ -67,7 +67,7 @@ void RPCSub::sendThread() // XXX Might not need this in a try. try { - cLog(lsDEBUG) << boost::str(boost::format("callRPC calling: %s") % mIp); + cLog(lsINFO) << boost::str(boost::format("callRPC calling: %s") % mIp); callRPC( theApp->getIOService(), @@ -79,7 +79,7 @@ void RPCSub::sendThread() } catch (const std::exception& e) { - cLog(lsDEBUG) << boost::str(boost::format("callRPC exception: %s") % e.what()); + cLog(lsINFO) << boost::str(boost::format("callRPC exception: %s") % e.what()); } } } while (bSend); @@ -93,11 +93,11 @@ void RPCSub::send(const Json::Value& jvObj) { // Drop the previous event. - cLog(lsDEBUG) << boost::str(boost::format("callRPC drop")); + cLog(lsWARNING) << boost::str(boost::format("callRPC drop")); mDeque.pop_back(); } - cLog(lsDEBUG) << boost::str(boost::format("callRPC push: %s") % jvObj); + cLog(lsINFO) << boost::str(boost::format("callRPC push: %s") % jvObj); mDeque.push_back(std::make_pair(mSeq++, jvObj)); @@ -106,7 +106,7 @@ void RPCSub::send(const Json::Value& jvObj) // Start a sending thread. mSending = true; - cLog(lsDEBUG) << boost::str(boost::format("callRPC start")); + cLog(lsINFO) << boost::str(boost::format("callRPC start")); boost::thread(boost::bind(&RPCSub::sendThread, this)).detach(); } } diff --git a/src/js/remote.js b/src/js/remote.js index 8c2beb1e5..efe050bfa 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -219,7 +219,7 @@ var Remote = function (opts, trace) { this.retry = undefined; this._load_base = 256; - this._load_fee = 256; + this._load_factor = 1.0; this._fee_ref = undefined; this._fee_base = undefined; this._reserve_base = undefined; @@ -574,6 +574,16 @@ Remote.prototype._connect_message = function (ws, json) { Remote.online_states.indexOf(message.server_status) !== -1 ? 'online' : 'offline'); + + if ('load_base' in message + && 'load_factor' in message + && (message.load_base !== this._load_base || message.load_factor != this._load_factor)) + { + this._load_base = message.load_base; + this._load_factor = message.load_factor; + + this.emit('load', { 'load_base' : this._load_base, 'load_factor' : this.load_factor }); + } break; // All other messages @@ -917,7 +927,7 @@ Remote.prototype._server_subscribe = function () { // FIXME Use this to estimate fee. self._load_base = message.load_base || 256; - self._load_fee = message.load_fee || 256; + self._load_factor = message.load_factor || 1.0; self._fee_ref = message.fee_ref; self._fee_base = message.fee_base; self._reserve_base = message.reverse_base;