From: Alan T. DeKok Date: Tue, 20 Dec 2016 16:40:21 +0000 (-0500) Subject: don't count RTT for NAKs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23b2dfd699ce4b83804ff5e0a6f42a8c42f1591f;p=thirdparty%2Ffreeradius-server.git don't count RTT for NAKs which have processing_time = 0 --- diff --git a/src/util/channel.c b/src/util/channel.c index ecff76b917c..631a8bafb90 100644 --- a/src/util/channel.c +++ b/src/util/channel.c @@ -358,9 +358,14 @@ fr_channel_data_t *fr_channel_recv_reply(fr_channel_t *ch) * BUT we use fixed-point arithmetic, so we need to use inverse alpha, * which works out to the following equation: * - * RTT_new = (RTT_old + (ialpha - 1) * RTT_sample) / ialpha + * RTT_new = (RTT_sample + (ialpha - 1) * RTT_old) / ialpha + * + * NAKs have zero processing time, so we ignore them for + * the purpose of RTT. */ - ch->processing_time = RTT(ch->processing_time, cd->reply.processing_time); + if (cd->reply.processing_time) { + ch->processing_time = RTT(ch->processing_time, cd->reply.processing_time); + } ch->cpu_time = cd->reply.cpu_time; /*