#include "devtools.h"
-static void trybind_nop_probe(void) {
+static void nop_probe(void) {
return;
}
return;
}
-void (*devtool_trybind_probe)(void) = trybind_nop_probe;
+static void inviter_commits_first_nop_probe(bool stage) {
+ (void)stage;
+ return;
+}
+
+static void sptps_renewal_nop_probe(meshlink_node_t *node) {
+ (void)node;
+ return;
+}
+
+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;
+void (*devtool_sptps_renewal_probe)(meshlink_node_t *node) = sptps_renewal_nop_probe;
/* Return an array of edges in the current network graph.
* Data captures the current state and will not be updated.
return NULL;
}
- pthread_mutex_lock(&(mesh->mesh_mutex));
+ pthread_mutex_lock(&mesh->mutex);
devtool_edge_t *result = NULL;
unsigned int result_size = 0;
for splay_each(edge_t, e, mesh->edges) {
// skip edges that do not represent a two-directional connection
- if((!e->reverse) || (e->reverse->to != e->from)) {
+ if(!e->reverse || e->reverse->to != e->from) {
continue;
}
meshlink_errno = MESHLINK_ENOMEM;
}
- pthread_mutex_unlock(&(mesh->mesh_mutex));
+ pthread_mutex_unlock(&mesh->mutex);
return result;
}
bool result = true;
- pthread_mutex_lock(&(mesh->mesh_mutex));
+ pthread_mutex_lock(&mesh->mutex);
// export edges and nodes
size_t node_count = 0;
free(nodes);
free(edges);
- pthread_mutex_unlock(&(mesh->mesh_mutex));
+ pthread_mutex_unlock(&mesh->mutex);
return result;
}
node_t *internal = (node_t *)node;
- pthread_mutex_lock(&mesh->mesh_mutex);
+ pthread_mutex_lock(&mesh->mutex);
memcpy(&status->status, &internal->status, sizeof status->status);
memcpy(&status->address, &internal->address, sizeof status->address);
status->udp_status = DEVTOOL_UDP_UNKNOWN;
}
- pthread_mutex_unlock(&mesh->mesh_mutex);
+ pthread_mutex_unlock(&mesh->mutex);
}
meshlink_submesh_t **devtool_get_all_submeshes(meshlink_handle_t *mesh, meshlink_submesh_t **submeshes, size_t *nmemb) {
meshlink_submesh_t **result;
//lock mesh->nodes
- pthread_mutex_lock(&(mesh->mesh_mutex));
+ pthread_mutex_lock(&mesh->mutex);
*nmemb = mesh->submeshes->count;
result = realloc(submeshes, *nmemb * sizeof(*submeshes));
meshlink_errno = MESHLINK_ENOMEM;
}
- pthread_mutex_unlock(&(mesh->mesh_mutex));
+ pthread_mutex_unlock(&mesh->mutex);
return result;
}
return handle;
}
+
+void devtool_force_sptps_renewal(meshlink_handle_t *mesh, meshlink_node_t *node) {
+ if(!mesh || !node) {
+ meshlink_errno = MESHLINK_EINVAL;
+ return;
+ }
+
+ node_t *n = (node_t *)node;
+ connection_t *c = n->connection;
+
+ n->last_req_key = -3600;
+
+ if(c) {
+ c->last_key_renewal = -3600;
+ }
+}