Tidy up NetworkOPs deadline timer usage

This commit is contained in:
Vinnie Falco
2013-07-10 15:45:36 -07:00
parent ecc864ac8e
commit aeae0fcf11
2 changed files with 16 additions and 8 deletions

View File

@@ -40,14 +40,8 @@ NetworkOPs::NetworkOPs (LedgerMaster* pLedgerMaster)
{
}
void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
void NetworkOPs::processNetTimer ()
{
if (timer == m_clusterTimer)
{
doClusterReport();
return;
}
ScopedLock sl (getApp().getMasterLock ());
getApp().getLoadManager ().resetDeadlockDetector ();
@@ -91,6 +85,18 @@ void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
mConsensus->timerEntry ();
}
void NetworkOPs::onDeadlineTimer (DeadlineTimer& timer)
{
if (timer == m_netTimer)
{
processNetTimer ();
}
else if (timer == m_clusterTimer)
{
doClusterReport();
}
}
std::string NetworkOPs::strOperatingMode ()
{
static const char* paStatusToken [] =
@@ -635,6 +641,7 @@ void NetworkOPs::setFeatureBlocked ()
void NetworkOPs::setStateTimer ()
{
m_netTimer.setRecurringExpiration (LEDGER_GRANULARITY / 1000.0);
m_clusterTimer.setRecurringExpiration (10.0);
}

View File

@@ -361,7 +361,8 @@ public:
InfoSub::pointer addRpcSub (const std::string& strUrl, InfoSub::ref rspEntry);
private:
void onDeadlineTimer (DeadlineTimer&);
void processNetTimer ();
void onDeadlineTimer (DeadlineTimer& timer);
void setMode (OperatingMode);