mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -239,25 +239,25 @@ void SqliteDatabase::runWal()
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock sl(walMutex);
|
||||
walDBs.swap(walSet);
|
||||
if (walSet.empty())
|
||||
if (walDBs.empty())
|
||||
{
|
||||
walRunning = false;
|
||||
return;
|
||||
}
|
||||
walDBs.swap(walSet);
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const std::string& db, walSet)
|
||||
{
|
||||
int log, ckpt;
|
||||
int log = 0, ckpt = 0;
|
||||
int ret = sqlite3_wal_checkpoint_v2(mConnection, db.c_str(), SQLITE_CHECKPOINT_PASSIVE, &log, &ckpt);
|
||||
if (ret != SQLITE_OK)
|
||||
{
|
||||
cLog((ret == SQLITE_LOCKED) ? lsTRACE : lsWARNING) << "WAL " << mHost << ":"
|
||||
cLog((ret == SQLITE_LOCKED) ? lsTRACE : lsWARNING) << "WAL " << name << ":"
|
||||
<< db << " error " << ret;
|
||||
}
|
||||
else
|
||||
cLog(lsTRACE) << "WAL(" << mHost << "): pass=" << pass << ", frames=" << log << ", written=" << ckpt;
|
||||
cLog(lsTRACE) << "WAL(" << name << "): pass=" << pass << ", frames=" << log << ", written=" << ckpt;
|
||||
}
|
||||
walSet.clear();
|
||||
++pass;
|
||||
|
||||
@@ -40,7 +40,7 @@ class AcceptedLedger
|
||||
public:
|
||||
typedef boost::shared_ptr<AcceptedLedger> pointer;
|
||||
typedef const pointer& ret;
|
||||
typedef std::map<int, ALTransaction> map_t;
|
||||
typedef std::map<int, ALTransaction> map_t; // Must be an ordered map!
|
||||
typedef map_t::value_type value_type;
|
||||
typedef map_t::const_iterator const_iterator;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Application* theApp = NULL;
|
||||
|
||||
DatabaseCon::DatabaseCon(const std::string& strName, const char *initStrings[], int initCount)
|
||||
{
|
||||
boost::filesystem::path pPath = (theConfig.RUN_STANDALONE && (!theConfig.START_UP != Config::LOAD))
|
||||
boost::filesystem::path pPath = (theConfig.RUN_STANDALONE && (theConfig.START_UP != Config::LOAD))
|
||||
? "" // Use temporary files.
|
||||
: (theConfig.DATA_DIR / strName); // Use regular db files.
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ TER PaymentTransactor::doApply()
|
||||
const STAmount saMaxAmount = bMax
|
||||
? mTxn.getFieldAmount(sfSendMax)
|
||||
: saDstAmount.isNative()
|
||||
? saDstAmount
|
||||
: STAmount(saDstAmount.getCurrency(), mTxnAccountID, saDstAmount.getMantissa(), saDstAmount.getExponent(), saDstAmount.isNegative());
|
||||
? saDstAmount
|
||||
: STAmount(saDstAmount.getCurrency(), mTxnAccountID, saDstAmount.getMantissa(), saDstAmount.getExponent(), saDstAmount.isNegative());
|
||||
const uint160 uSrcCurrency = saMaxAmount.getCurrency();
|
||||
const uint160 uDstCurrency = saDstAmount.getCurrency();
|
||||
const bool bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero();
|
||||
|
||||
@@ -72,6 +72,7 @@ Json::Value rpcError(int iError, Json::Value jvResult)
|
||||
{ rpcUNKNOWN_COMMAND, "unknownCmd", "Unknown method." },
|
||||
{ rpcWRONG_SEED, "wrongSeed", "The regular key does not point as the master key." },
|
||||
{ rpcTOO_BUSY, "tooBusy", "The server is too busy to help you now." },
|
||||
{ rpcSLOW_DOWN, "slowDown", "You are placing too much load on the server." },
|
||||
};
|
||||
|
||||
int i;
|
||||
|
||||
@@ -18,6 +18,7 @@ enum {
|
||||
rpcNO_EVENTS,
|
||||
rpcNOT_STANDALONE,
|
||||
rpcTOO_BUSY,
|
||||
rpcSLOW_DOWN,
|
||||
|
||||
// Networking
|
||||
rpcNO_CLOSED,
|
||||
|
||||
@@ -1152,6 +1152,13 @@ Json::Value RPCHandler::doRandom(Json::Value jvRequest, int& cost)
|
||||
// - From a trusted server, allows clients to use path without manipulation.
|
||||
Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost)
|
||||
{
|
||||
int jc = theApp->getJobQueue().getJobCountGE(jtCLIENT);
|
||||
if (jc > 200)
|
||||
{
|
||||
cLog(lsDEBUG) << "Too busy for RPF: " << jc;
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
}
|
||||
|
||||
RippleAddress raSrc;
|
||||
RippleAddress raDst;
|
||||
STAmount saDstAmount;
|
||||
@@ -1161,11 +1168,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest, int& cost)
|
||||
if (!lpLedger)
|
||||
return jvResult;
|
||||
|
||||
if (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 200)
|
||||
{
|
||||
jvResult = rpcError(rpcTOO_BUSY);
|
||||
}
|
||||
else if (!jvRequest.isMember("source_account"))
|
||||
if (!jvRequest.isMember("source_account"))
|
||||
{
|
||||
jvResult = rpcError(rpcSRC_ACT_MISSING);
|
||||
}
|
||||
@@ -2895,8 +2898,15 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole, int &
|
||||
{
|
||||
if (cost == 0)
|
||||
cost = rpcCOST_DEFAULT;
|
||||
if ((iRole != ADMIN) && (theApp->getJobQueue().getJobCountGE(jtCLIENT) > 500))
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
if (iRole != ADMIN)
|
||||
{
|
||||
int jc = theApp->getJobQueue().getJobCountGE(jtCLIENT);
|
||||
if (jc > 500)
|
||||
{
|
||||
cLog(lsDEBUG) << "Too busy for command: " << jc;
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
}
|
||||
}
|
||||
|
||||
if (!jvRequest.isMember("command"))
|
||||
return rpcError(rpcCOMMAND_MISSING);
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
connection_ptr ptr = mConnection.lock();
|
||||
if (ptr)
|
||||
ptr->close(websocketpp::close::status::PROTOCOL_ERROR, "overload");
|
||||
return rpcError(rpcTOO_BUSY);
|
||||
return rpcError(rpcSLOW_DOWN);
|
||||
}
|
||||
|
||||
if (!jvRequest.isMember("command"))
|
||||
|
||||
Reference in New Issue
Block a user