[sr-dev] git:master:f10f3b51: dispatcher: track time of last dns timer update

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 8 16:17:32 CEST 2022


Module: kamailio
Branch: master
Commit: f10f3b516ccab7f2bca8ff71c3fa34b915fc03f6
URL: https://github.com/kamailio/kamailio/commit/f10f3b516ccab7f2bca8ff71c3fa34b915fc03f6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-04-08T16:17:02+02:00

dispatcher: track time of last dns timer update

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/dispatcher.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f10f3b516ccab7f2bca8ff71c3fa34b915fc03f6.diff
Patch: https://github.com/kamailio/kamailio/commit/f10f3b516ccab7f2bca8ff71c3fa34b915fc03f6.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 0f6a6b178f..9d9b849183 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -3889,6 +3889,7 @@ void ds_dns_update_set(ds_set_t *node)
 		} else {
 			/* Store hostent in the dispatcher structure */
 			hostent2ip_addr(&node->dlist[j].ip_address, he, 0);
+			gettimeofday(&node->dlist[j].dnstime, NULL);
 		}
 	}
 }
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index 3eaa9894dd..99c63eb7b9 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -29,6 +29,7 @@
 #define _DISPATCH_H_
 
 #include <stdio.h>
+#include <sys/time.h>
 #include "../../core/pvar.h"
 #include "../../core/xavp.h"
 #include "../../core/parser/msg_parser.h"
@@ -231,6 +232,7 @@ typedef struct _ds_dest {
 	unsigned short int port; 	/*!< port of the URI */
 	unsigned short int proto; 	/*!< protocol of the URI */
 	int message_count;
+	struct timeval dnstime;
 	struct _ds_dest *next;
 } ds_dest_t;
 
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index ccf579fba8..8dea1f29f3 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1664,9 +1664,11 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle,
 		if(mode == DS_RPC_PRINT_FULL) {
 			ipbuf[0] = '\0';
 			ip_addr2sbufz(&node->dlist[j].ip_address, ipbuf, IP_ADDR_MAX_STRZ_SIZE);
-			if(rpc->struct_add(vh, "Ssdd", "HOST", &node->dlist[j].host,
+			if(rpc->struct_add(vh, "Ssddjj", "HOST", &node->dlist[j].host,
 						"IPADDR", ipbuf, "PORT", (int)node->dlist[j].port,
-						"PROTOID", (int)node->dlist[j].proto) < 0) {
+						"PROTOID", (int)node->dlist[j].proto,
+						"DNSTIME_SEC", (unsigned long)node->dlist[j].dnstime.tv_sec,
+						"DNSTIME_USEC", (unsigned long)node->dlist[j].dnstime.tv_usec) < 0) {
 				rpc->fault(ctx, 500, "Internal error creating dest struct");
 				return -1;
 			}




More information about the sr-dev mailing list