Skip to content

Commit

Permalink
dispatcher: track time of last dns timer update
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 8, 2022
1 parent a7e9eb0 commit f10f3b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/modules/dispatcher/dispatch.c
Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/modules/dispatcher/dispatch.h
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions src/modules/dispatcher/dispatcher.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit f10f3b5

Please sign in to comment.