Prechádzať zdrojové kódy

fix(server): call serverOnNetworkCallback for every client mdns package

Stefan Profanter 5 rokov pred
rodič
commit
6b93d4e0f7
1 zmenil súbory, kde vykonal 9 pridanie a 1 odobranie
  1. 9 1
      src/server/ua_server_discovery_mdns.c

+ 9 - 1
src/server/ua_server_discovery_mdns.c

@@ -488,8 +488,16 @@ mdns_record_received(const struct resource *r, void *data) {
     entry->lastSeen = UA_DateTime_nowMonotonic();
 
     /* TXT and SRV are already set */
-    if(entry->txtSet && entry->srvSet)
+    if(entry->txtSet && entry->srvSet) {
+        // call callback for every mdns package we received.
+        // This will also call the callback multiple times
+        if (server->discoveryManager.serverOnNetworkCallback &&
+            !mdns_is_self_announce(server, entry))
+            server->discoveryManager.
+                serverOnNetworkCallback(&entry->serverOnNetwork, true, entry->txtSet,
+                                        server->discoveryManager.serverOnNetworkCallbackData);
         return;
+    }
 
     /* Add the resources */
     if(r->type == QTYPE_TXT && !entry->txtSet)