summaryrefslogtreecommitdiff
path: root/node/Switch.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-10-03 14:38:07 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-10-03 14:38:07 -0400
commitc7590634e881f573dd07437ca8b719df621e8777 (patch)
tree77870fb71e7ad94d8c694cd9ad090a0b0bc64fd9 /node/Switch.cpp
parent58538500f26d6e362bac0275c11628222fdcac02 (diff)
downloadinfinitytier-c7590634e881f573dd07437ca8b719df621e8777.tar.gz
infinitytier-c7590634e881f573dd07437ca8b719df621e8777.zip
Eliminate a lot of redundant WHOIS requests, clean up WHOIS clutter in TRACE, flesh out multicast tracing a bit.
Diffstat (limited to 'node/Switch.cpp')
-rw-r--r--node/Switch.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp
index f471700c..55c21f09 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -438,14 +438,17 @@ void Switch::announceMulticastGroups(const SharedPtr<Peer> &peer)
void Switch::requestWhois(const Address &addr)
{
- TRACE("requesting WHOIS for %s",addr.toString().c_str());
+ //TRACE("requesting WHOIS for %s",addr.toString().c_str());
+ bool inserted = false;
{
Mutex::Lock _l(_outstandingWhoisRequests_m);
std::pair< std::map< Address,WhoisRequest >::iterator,bool > entry(_outstandingWhoisRequests.insert(std::pair<Address,WhoisRequest>(addr,WhoisRequest())));
- entry.first->second.lastSent = Utils::now();
+ if ((inserted = entry.second))
+ entry.first->second.lastSent = Utils::now();
entry.first->second.retries = 0; // reset retry count if entry already existed
}
- _sendWhoisRequest(addr,(const Address *)0,0);
+ if (inserted)
+ _sendWhoisRequest(addr,(const Address *)0,0);
}
void Switch::doAnythingWaitingForPeer(const SharedPtr<Peer> &peer)