Some trivial cleanups/fixes:

* Avoid throwing in OrderBookDB::processTxn
* Fix missing space in debug output
* Avoid duplicate lock of PathRequest in updateAll
* Avoid shadowing in insertPathRequest
* Improve indentation in runOnCoroutine
* Remove extraneous space in ServerHandlerImp::processRequest
This commit is contained in:
JoelKatz
2015-10-02 11:53:35 -07:00
committed by Vinnie Falco
parent 5b6cc3b036
commit 333ba69d60
5 changed files with 11 additions and 9 deletions

View File

@@ -257,7 +257,9 @@ void OrderBookDB::processTxn (
auto data = dynamic_cast<const STObject*> ( auto data = dynamic_cast<const STObject*> (
node.peekAtPField (*field)); node.peekAtPField (*field));
if (data) if (data &&
data->isFieldPresent (sfTakerPays) &&
data->isFieldPresent (sfTakerGets))
{ {
// determine the OrderBook // determine the OrderBook
auto listeners = getBookListeners ( auto listeners = getBookListeners (

View File

@@ -670,7 +670,7 @@ public:
{ {
// A new ledger has been accepted as part of the trusted chain // A new ledger has been accepted as part of the trusted chain
JLOG (m_journal.debug) << "Ledger " << ledger->info().seq JLOG (m_journal.debug) << "Ledger " << ledger->info().seq
<< "accepted :" << ledger->getHash (); << " accepted :" << ledger->getHash ();
assert (ledger->stateMap().getHash ().isNonZero ()); assert (ledger->stateMap().getHash ().isNonZero ());
ledger->setValidated(); ledger->setValidated();

View File

@@ -113,8 +113,6 @@ void PathRequests::updateAll (std::shared_ptr <ReadView const> const& inLedger,
if (remove) if (remove)
{ {
PathRequest::pointer pRequest = wRequest.lock ();
ScopedLockType sl (mLock); ScopedLockType sl (mLock);
// Remove any dangling weak pointers or weak pointers that refer to this path request. // Remove any dangling weak pointers or weak pointers that refer to this path request.
@@ -179,8 +177,8 @@ void PathRequests::insertPathRequest (PathRequest::pointer const& req)
std::vector<PathRequest::wptr>::iterator it = mRequests.begin (); std::vector<PathRequest::wptr>::iterator it = mRequests.begin ();
while (it != mRequests.end ()) while (it != mRequests.end ())
{ {
PathRequest::pointer req = it->lock (); PathRequest::pointer r = it->lock ();
if (req && !req->isNew ()) if (r && !r->isNew ())
break; // This request has been handled, we come before it break; // This request has been handled, we come before it
// This is a newer request, we come after it // This is a newer request, we come after it

View File

@@ -52,8 +52,10 @@ void runOnCoroutineImpl(std::shared_ptr<Pull> pull)
void runOnCoroutine(Coroutine const& coroutine) void runOnCoroutine(Coroutine const& coroutine)
{ {
auto pullFunction = [coroutine] (Push& push) { auto pullFunction = [coroutine] (Push& push)
Suspend suspend = [&push] (CoroutineType const& cbc) { {
Suspend suspend = [&push] (CoroutineType const& cbc)
{
if (push) if (push)
push (cbc); push (cbc);
}; };

View File

@@ -347,7 +347,7 @@ ServerHandlerImp::processRequest (
// Provide the JSON-RPC method as the field "command" in the request. // Provide the JSON-RPC method as the field "command" in the request.
params[jss::command] = strMethod; params[jss::command] = strMethod;
JLOG (m_journal.trace) JLOG (m_journal.trace)
<< "doRpcCommand:" << strMethod << ":" << params; << "doRpcCommand:" << strMethod << ":" << params;
auto const start (std::chrono::high_resolution_clock::now ()); auto const start (std::chrono::high_resolution_clock::now ());