From: Remi Gacogne Date: Fri, 6 Nov 2015 14:25:20 +0000 (+0100) Subject: Display "No traffic yet." when showResponseLatency() is called before any packet... X-Git-Tag: dnsdist-1.0.0-alpha1~224^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2870%2Fhead;p=thirdparty%2Fpdns.git Display "No traffic yet." when showResponseLatency() is called before any packet has been processed. Fixes #2865. --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 8d10c9fc1e..a7bc221473 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -750,6 +750,11 @@ vector> setupLua(bool client, const std::string& confi } } + if (size == 0) { + g_outputBuffer = "No traffic yet.\n"; + return; + } + g_outputBuffer = (boost::format("Average response latency: %.02f msec\n") % (0.001*totlat/size)).str(); double highest=0;