From: Guus Sliepen Date: Sat, 11 Apr 2020 14:33:22 +0000 (+0200) Subject: Add a probe point for async DNS resolving. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=f13c6d9a4dbfce011fc4c3a5260b38b9a2a4fcc5 Add a probe point for async DNS resolving. --- diff --git a/src/adns.c b/src/adns.c index 2776a4c5..8181140d 100644 --- a/src/adns.c +++ b/src/adns.c @@ -23,6 +23,7 @@ #include #include "adns.h" +#include "devtools.h" #include "logger.h" #include "xalloc.h" @@ -48,6 +49,7 @@ static void *adns_loop(void *data) { if(time(NULL) < item->deadline) { logger(mesh, MESHLINK_DEBUG, "Resolving %s port %s", item->host, item->serv); + devtool_adns_resolve_probe(); int result = getaddrinfo(item->host, item->serv, NULL, &item->ai); if(result) { @@ -143,6 +145,7 @@ void *adns_blocking_handler(void *data) { struct adns_blocking_info *info = data; logger(info->mesh, MESHLINK_DEBUG, "Resolving %s port %s", info->host, info->serv); + devtool_adns_resolve_probe(); if(getaddrinfo(info->host, info->serv, NULL, &info->ai)) { info->ai = NULL; diff --git a/src/devtools.c b/src/devtools.c index 5a49e3a8..5bd06180 100644 --- a/src/devtools.c +++ b/src/devtools.c @@ -30,7 +30,7 @@ #include "devtools.h" -static void trybind_nop_probe(void) { +static void nop_probe(void) { return; } @@ -44,9 +44,10 @@ static void inviter_commits_first_nop_probe(bool stage) { return; } -void (*devtool_trybind_probe)(void) = trybind_nop_probe; +void (*devtool_trybind_probe)(void) = nop_probe; void (*devtool_keyrotate_probe)(int stage) = keyrotate_nop_probe; void (*devtool_set_inviter_commits_first)(bool inviter_commited_first) = inviter_commits_first_nop_probe; +void (*devtool_adns_resolve_probe)(void) = nop_probe; /* Return an array of edges in the current network graph. * Data captures the current state and will not be updated. diff --git a/src/devtools.h b/src/devtools.h index 6d0b4989..79aef33a 100644 --- a/src/devtools.h +++ b/src/devtools.h @@ -166,6 +166,9 @@ extern void (*devtool_trybind_probe)(void); */ extern void (*devtool_keyrotate_probe)(int stage); +/// Debug function pointer variable for asynchronous DNS resolving +extern void (*devtool_adns_resolve_probe)(void); + /// Debug function pointer variable for asserting inviter/invitee committing sequence /** This function pointer variable is a userspace tracepoint or debugger callback which * invokes either after inviter writing invitees host file into the disk