From: bert hubert Date: Mon, 9 Oct 2017 18:43:20 +0000 (+0200) Subject: as expected, the 'delta' latency between time passed and time spent on network someti... X-Git-Tag: rec-4.1.0-rc2~24^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=042da1a172abf7647668517a55ec73f799a28fbd;p=thirdparty%2Fpdns.git 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) --- 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"<