]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Calculate incoming queries RTT statistics
authorAram Sargsyan <aram@isc.org>
Thu, 15 Jan 2026 15:03:09 +0000 (15:03 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Thu, 26 Feb 2026 14:00:10 +0000 (14:00 +0000)
In client_senddone() update the RTT statistics for the incoming
queries.

lib/ns/client.c

index 3c42a85bf0d25c0705fdde29531d199a3536abb4..c0a5649a3bcec0fe1583ea9956ca77a44eeb9505 100644 (file)
@@ -325,7 +325,24 @@ client_senddone(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
         */
        client->inner.sendhandle = NULL;
 
-       if (result != ISC_R_SUCCESS) {
+       if (result == ISC_R_SUCCESS) {
+               isc_histomulti_t *hmpin = NULL;
+
+               if (client->inner.view != NULL &&
+                   client->inner.view->resolver != NULL)
+               {
+                       dns_resolver_getqueryrttstats(
+                               client->inner.view->resolver, &hmpin, NULL);
+               }
+               if (hmpin != NULL) {
+                       const unsigned int rtt = (unsigned int)
+                               isc_time_microdiff(&client->inner.tnow,
+                                                  &client->inner.requesttime);
+                       const unsigned int rttms = rtt / US_PER_MS;
+                       isc_histomulti_inc(hmpin, rttms);
+                       isc_histomulti_detach(&hmpin);
+               }
+       } else {
                if (!TCP_CLIENT(client) && result == ISC_R_MAXSIZE) {
                        ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
                                      NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),