diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-10-03 14:38:07 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-10-03 14:38:07 -0400 |
commit | c7590634e881f573dd07437ca8b719df621e8777 (patch) | |
tree | 77870fb71e7ad94d8c694cd9ad090a0b0bc64fd9 /node/Switch.cpp | |
parent | 58538500f26d6e362bac0275c11628222fdcac02 (diff) | |
download | infinitytier-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.cpp | 9 |
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) |