DefaultPeerStorage: Add warn log when Peer::usedBy is non zero on checkoutPeer

pull/150/head
Tatsuhiro Tsujikawa 2013-10-26 20:02:48 +09:00
parent 12fe61820a
commit 234dd76cd4
1 changed files with 5 additions and 0 deletions

View File

@ -231,6 +231,11 @@ std::shared_ptr<Peer> DefaultPeerStorage::checkoutPeer(cuid_t cuid)
} }
std::shared_ptr<Peer> peer = unusedPeers_.front(); std::shared_ptr<Peer> peer = unusedPeers_.front();
unusedPeers_.pop_front(); unusedPeers_.pop_front();
if(peer->usedBy() != 0) {
A2_LOG_WARN(fmt("CUID#%" PRId64 " is already set for peer %s:%u",
peer->usedBy(),
peer->getIPAddress().c_str(), peer->getOrigPort()));
}
peer->usedBy(cuid); peer->usedBy(cuid);
usedPeers_.insert(peer); usedPeers_.insert(peer);
A2_LOG_DEBUG(fmt("Checkout peer %s:%u to CUID#%" PRId64, A2_LOG_DEBUG(fmt("Checkout peer %s:%u to CUID#%" PRId64,