X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fmeshlink.c;h=0bec2f8aaf831c2cfd663f36fb7c0f97a7155633;hp=2309d77521865147a0f584701df518bd635c12a4;hb=c1aaccb26739c0c513c9443dce57560349141687;hpb=fad8bcd322f0413cc1b2c61cc18a37d5c980afeb diff --git a/src/meshlink.c b/src/meshlink.c index 2309d775..0bec2f8a 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -2155,7 +2155,7 @@ bool meshlink_get_node_reachability(struct meshlink_handle *mesh, struct meshlin bool reachable; pthread_mutex_lock(&mesh->mutex); - reachable = n->status.reachable; + reachable = n->status.reachable && !n->status.blacklisted; if(last_reachable) { *last_reachable = n->last_reachable; @@ -2975,6 +2975,10 @@ static bool blacklist(meshlink_handle_t *mesh, node_t *n) { n->mtuprobes = 0; n->status.udp_confirmed = false; + if(n->status.reachable) { + n->last_unreachable = mesh->loop.now.tv_sec; + } + /* Graph updates will suppress status updates for blacklisted nodes, so we need to * manually call the status callback if necessary. */ @@ -3046,6 +3050,7 @@ static bool whitelist(meshlink_handle_t *mesh, node_t *n) { n->status.blacklisted = false; if(n->status.reachable) { + n->last_reachable = mesh->loop.now.tv_sec; update_node_status(mesh, n); }