]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't count RTT for NAKs
authorAlan T. DeKok <aland@freeradius.org>
Tue, 20 Dec 2016 16:40:21 +0000 (11:40 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 20 Dec 2016 16:40:21 +0000 (11:40 -0500)
which have processing_time = 0

src/util/channel.c

index ecff76b917cb9da95f7405386f7d119af6002781..631a8bafb90ab4e89fb5c0e702b671973c2e0105 100644 (file)
@@ -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;
 
        /*