From f5783820f8f1d975e3cc22c64fb8125592796c8b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 9 Jul 2012 10:42:44 -0700 Subject: [PATCH] Detect "radio silence" --- src/NetworkOPs.cpp | 6 ++++-- src/NetworkOPs.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 32fcd0f7c1..3b1abcf5bc 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -334,8 +334,8 @@ void NetworkOPs::checkState(const boost::system::error_code& result) // check if the ledger is bad enough to go to omTRACKING } - uint64 defaultClose = theApp->getMasterLedger().getCurrentLedger()->getCloseTimeNC(); - uint64 now = theApp->getOPs().getNetworkTimeNC(); +// uint64 defaultClose = theApp->getMasterLedger().getCurrentLedger()->getCloseTimeNC(); +// uint64 now = theApp->getOPs().getNetworkTimeNC(); if (!mConsensus) { // if now is past the ledger's default close time or there are transactions in the current ledger, close if ((theApp->getOPs().getNetworkTimeNC() > theApp->getMasterLedger().getCurrentLedger()->getCloseTimeNC()) @@ -613,6 +613,8 @@ void NetworkOPs::endConsensus() void NetworkOPs::setMode(OperatingMode om) { if (mMode == om) return; + if ((om >= omCONNECTED) && (mMode == omDISCONNECTED)) + mConnectTime = boost::posix_time::second_clock::universal_time(); if (mMode == omFULL) { if (mConsensus) diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index c9e362d371..a4695fc990 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -46,6 +46,7 @@ public: protected: OperatingMode mMode; + boost::posix_time::ptime mConnectTime; boost::asio::deadline_timer mNetTimer; boost::shared_ptr mConsensus;