From e12b3374aa5de1dd755bc4a7885ca555c6e64d3c Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 6 Nov 2015 15:25:20 +0100 Subject: [PATCH] Display "No traffic yet." when showResponseLatency() is called before any packet has been processed. Fixes #2865. --- pdns/dnsdist-lua.cc | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.40.0