Code cleanup

pull/4/head
Tatsuhiro Tsujikawa 2011-12-08 21:51:52 +09:00
parent f0bcfa822e
commit 30e0e19e67
2 changed files with 7 additions and 7 deletions

View File

@ -63,7 +63,7 @@ const time_t GET_PEER_INTERVAL_ZERO = 60;
// Interval for retry. // Interval for retry.
const time_t GET_PEER_INTERVAL_RETRY = 5; const time_t GET_PEER_INTERVAL_RETRY = 5;
// Maximum retries. Try more than 5 to drop bad node. // Maximum retries. Try more than 5 to drop bad node.
const size_t MAX_RETRIES = 10; const int MAX_RETRIES = 10;
} // namespace } // namespace
@ -112,13 +112,13 @@ bool DHTGetPeersCommand::execute()
lastGetPeerTime_ = global::wallclock(); lastGetPeerTime_ = global::wallclock();
if(numRetry_ < MAX_RETRIES && if(numRetry_ < MAX_RETRIES &&
(btRuntime_->getMaxPeers() == 0 || (btRuntime_->getMaxPeers() == 0 ||
btRuntime_->getMaxPeers() > peerStorage_->countPeer())) { btRuntime_->getMaxPeers()) > peerStorage_->countPeer()) {
++numRetry_; ++numRetry_;
A2_LOG_DEBUG(fmt("Too few peers. peers=%lu, max_peers=%lu." A2_LOG_DEBUG(fmt("Too few peers. peers=%lu, max_peers=%d."
" Try again(%lu)", " Try again(%d)",
static_cast<unsigned long>(peerStorage_->countPeer()), static_cast<unsigned long>(peerStorage_->countPeer()),
static_cast<unsigned long>(btRuntime_->getMaxPeers()), btRuntime_->getMaxPeers(),
static_cast<unsigned long>(numRetry_))); numRetry_));
} else { } else {
numRetry_ = 0; numRetry_ = 0;
} }

View File

@ -66,7 +66,7 @@ private:
SharedHandle<DHTTask> task_; SharedHandle<DHTTask> task_;
size_t numRetry_; int numRetry_;
Timer lastGetPeerTime_; Timer lastGetPeerTime_;
public: public: