From 3c496b07f9dace1657b29faee354ae09cfaad82c Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 20 Nov 2015 14:37:14 -0800 Subject: [PATCH] Don't include zero traffic levels --- src/ripple/overlay/impl/TrafficCount.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ripple/overlay/impl/TrafficCount.h b/src/ripple/overlay/impl/TrafficCount.h index 81385888d8..85fa6a22da 100644 --- a/src/ripple/overlay/impl/TrafficCount.h +++ b/src/ripple/overlay/impl/TrafficCount.h @@ -53,6 +53,11 @@ public: , messagesIn (ts.messagesIn.load()) , messagesOut (ts.messagesOut.load()) { ; } + + operator bool () const + { + return messagesIn || messagesOut; + } }; @@ -107,9 +112,10 @@ public: for (auto& i : counts_) { - ret.emplace (std::piecewise_construct, - std::forward_as_tuple (getName (i.first)), - std::forward_as_tuple (i.second)); + if (i.second) + ret.emplace (std::piecewise_construct, + std::forward_as_tuple (getName (i.first)), + std::forward_as_tuple (i.second)); } return ret;