From 042da1a172abf7647668517a55ec73f799a28fbd Mon Sep 17 00:00:00 2001 From: bert hubert Date: Mon, 9 Oct 2017 20:43:20 +0200 Subject: [PATCH] as expected, the 'delta' latency between time passed and time spent on network sometimes goes negative (because we use timers like that). Protect ourselves against messing up the stats when that happens (it is very rare, but it happened to me) --- pdns/pdns_recursor.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 55b88eeb0e..7508f9362e 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1271,10 +1271,10 @@ static void startDoResolve(void *p) // cerr<<"SLOW: "< "<d_mdp.d_qname<<"|"<d_mdp.d_qtype)<= 0.0) { + newLat=ourtime*1000; // usec + g_stats.avgLatencyOursUsec=(1-1.0/g_latencyStatSize)*g_stats.avgLatencyOursUsec + (float)newLat/g_latencyStatSize; + } // cout<d_mdp.d_qname<<"\t"<getUsec()<<"\t"<