Don't run the timer routine of the timer was cancelled/aborted.

This commit is contained in:
JoelKatz
2012-05-09 17:27:34 -07:00
parent 238d8ee114
commit 0139304b98
2 changed files with 6 additions and 3 deletions

View File

@@ -159,7 +159,7 @@ void NetworkOPs::setStateTimer(int sec)
else if (sec > (closedTime - now)) sec = (closedTime - now);
mNetTimer.expires_from_now(boost::posix_time::seconds(sec));
mNetTimer.async_wait(boost::bind(&NetworkOPs::checkState, this));
mNetTimer.async_wait(boost::bind(&NetworkOPs::checkState, this, boost::asio::placeholders::error));
}
class ValidationCount
@@ -181,8 +181,11 @@ public:
}
};
void NetworkOPs::checkState()
void NetworkOPs::checkState(const boost::system::error_code& result)
{ // Network state machine
if (result == boost::asio::error::operation_aborted)
return;
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
// do we have sufficient peers? If not, we are disconnected.

View File

@@ -66,7 +66,7 @@ public:
const std::vector<unsigned char>& myNode, std::list<std::vector<unsigned char> >& newNodes);
// network state machine
void checkState();
void checkState(const boost::system::error_code& result);
void switchLastClosedLedger(Ledger::pointer newLedger, bool normal);
void setStateTimer(int seconds);