From 7f29336d0b0af59a7a6e94a0e0acbd17be19ca25 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 5 Mar 2013 23:38:05 -0800 Subject: [PATCH] Fix crash when using open ledger to take initial position. --- src/cpp/ripple/NetworkOPs.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 44f8086a63..2754aab458 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -595,10 +595,14 @@ public: void NetworkOPs::checkState(const boost::system::error_code& result) { // Network state machine + if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE) return; + setStateTimer(); + ScopedLock(theApp->getMasterLock()); + std::vector peerList = theApp->getConnectionPool().getPeerVector(); // do we have sufficient peers? If not, we are disconnected. @@ -618,12 +622,9 @@ void NetworkOPs::checkState(const boost::system::error_code& result) cLog(lsINFO) << "Node count (" << peerList.size() << ") is sufficient."; } - if (mConsensus) - { - mConsensus->timerEntry(); - return; - } - tryStartConsensus(); + if (!mConsensus) + tryStartConsensus(); + if (mConsensus) mConsensus->timerEntry(); } @@ -632,7 +633,7 @@ void NetworkOPs::tryStartConsensus() { uint256 networkClosed; bool ledgerChange = checkLastClosedLedger(theApp->getConnectionPool().getPeerVector(), networkClosed); - if(networkClosed.isZero()) + if (networkClosed.isZero()) return; // WRITEME: Unless we are in omFULL and in the process of doing a consensus,