]> git.meshlink.io Git - meshlink/commitdiff
Add a probe point for async DNS resolving.
authorGuus Sliepen <guus@meshlink.io>
Sat, 11 Apr 2020 14:33:22 +0000 (16:33 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sat, 11 Apr 2020 14:38:21 +0000 (16:38 +0200)
src/adns.c
src/devtools.c
src/devtools.h

index 2776a4c5494bfa562ecb4163812c89740d925957..8181140d15ddb011e3837bff81119b272b9fd9f5 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdatomic.h>
 
 #include "adns.h"
 #include <stdatomic.h>
 
 #include "adns.h"
+#include "devtools.h"
 #include "logger.h"
 #include "xalloc.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);
 
                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) {
                        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);
        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;
 
        if(getaddrinfo(info->host, info->serv, NULL, &info->ai)) {
                info->ai = NULL;
index 5a49e3a860296a66ad049bd7d238946424ef1b2d..5bd061800a0c72f7445cab68cb344d6570470f8c 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "devtools.h"
 
 
 #include "devtools.h"
 
-static void trybind_nop_probe(void) {
+static void nop_probe(void) {
        return;
 }
 
        return;
 }
 
@@ -44,9 +44,10 @@ static void inviter_commits_first_nop_probe(bool stage) {
        return;
 }
 
        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_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.
 
 /* Return an array of edges in the current network graph.
  * Data captures the current state and will not be updated.
index 6d0b4989c3ce32c18c124faf8bef9219794ba712..79aef33a365dd01be4c06668414106dac8106cf4 100644 (file)
@@ -166,6 +166,9 @@ extern void (*devtool_trybind_probe)(void);
  */
 extern void (*devtool_keyrotate_probe)(int stage);
 
  */
 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
 /// 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