From: Guus Sliepen Date: Sun, 12 Jul 2020 19:36:53 +0000 (+0200) Subject: Resend mDNS packets on all known addresses if meshlink_reset_timers() is called. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=7da7914012ab48c3ac5ab68ae163b56000d69ecb;p=meshlink Resend mDNS packets on all known addresses if meshlink_reset_timers() is called. --- diff --git a/src/discovery.c b/src/discovery.c index df5dda72..e0e4fb4e 100644 --- a/src/discovery.c +++ b/src/discovery.c @@ -678,3 +678,11 @@ void discovery_stop(meshlink_handle_t *mesh) { } } } + +void discovery_refresh(meshlink_handle_t *mesh) { + for(int i = 0; i < mesh->discovery_address_count; i++) { + if(mesh->discovery_addresses[i].up) { + send_mdns_packet(mesh, &mesh->discovery_addresses[i]); + } + } +} diff --git a/src/discovery.h b/src/discovery.h index 48571695..d3b8e004 100644 --- a/src/discovery.h +++ b/src/discovery.h @@ -24,5 +24,6 @@ bool discovery_start(meshlink_handle_t *mesh); void discovery_stop(meshlink_handle_t *mesh); +void discovery_refresh(meshlink_handle_t *mesh); #endif diff --git a/src/meshlink.c b/src/meshlink.c index b3943791..ba2c84be 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -4562,6 +4562,11 @@ void meshlink_reset_timers(struct meshlink_handle *mesh) { } handle_network_change(mesh, true); + + if(mesh->discovery) { + discovery_refresh(mesh); + } + pthread_mutex_unlock(&mesh->mutex); }