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: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e12b3374aa5de1dd755bc4a7885ca555c6e64d3c;p=pdns 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 8d10c9fc1..a7bc22147 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;