]> granicus.if.org Git - pdns/commitdiff
Display "No traffic yet." when showResponseLatency() is called before any packet...
authorRemi Gacogne <rgacogne-github@coredump.fr>
Fri, 6 Nov 2015 14:25:20 +0000 (15:25 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Fri, 6 Nov 2015 14:26:55 +0000 (15:26 +0100)
pdns/dnsdist-lua.cc

index 8d10c9fc1e26be41e6816270831588bc983ceb07..a7bc221473ec5b82134393bc404584c3b81d52f0 100644 (file)
@@ -750,6 +750,11 @@ vector<std::function<void(void)>> 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;