]> git.meshlink.io Git - meshlink/commitdiff
Resend mDNS packets on all known addresses if meshlink_reset_timers() is called.
authorGuus Sliepen <guus@meshlink.io>
Sun, 12 Jul 2020 19:36:53 +0000 (21:36 +0200)
committerGuus Sliepen <guus@meshlink.io>
Thu, 15 Apr 2021 18:30:51 +0000 (20:30 +0200)
src/discovery.c
src/discovery.h
src/meshlink.c

index df5dda726f699075ef18751f5a817b8d15fe50d2..e0e4fb4ed3e346b46da63287db2141f2f4f6ec78 100644 (file)
@@ -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]);
+               }
+       }
+}
index 48571695c52756a2c475b4364bbf7c3a2d88571d..d3b8e0047b9f730ed9faaab7e4d344f27375eefd 100644 (file)
@@ -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
index d9bd0146e94cedaf4b6dc5967e28f6a4f00483c9..8502f434c0c7a81e0ae4a8068fb234910103b7ac 100644 (file)
@@ -4641,6 +4641,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);
 }