From 234dd76cd43b53d4b32490bd67f534951410fae1 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 26 Oct 2013 20:02:48 +0900 Subject: [PATCH] DefaultPeerStorage: Add warn log when Peer::usedBy is non zero on checkoutPeer --- src/DefaultPeerStorage.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DefaultPeerStorage.cc b/src/DefaultPeerStorage.cc index 02be48db..0a3dcf9e 100644 --- a/src/DefaultPeerStorage.cc +++ b/src/DefaultPeerStorage.cc @@ -231,6 +231,11 @@ std::shared_ptr DefaultPeerStorage::checkoutPeer(cuid_t cuid) } std::shared_ptr peer = unusedPeers_.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); usedPeers_.insert(peer); A2_LOG_DEBUG(fmt("Checkout peer %s:%u to CUID#%" PRId64,