]> git.meshlink.io Git - catta/blobdiff - avahi-core/browse.c
update examples to make use of avahi_string_list_get_service_cookie() for whatever...
[catta] / avahi-core / browse.c
index 3fb22c833c362877977cda6c9487618d6b542378..fa97c351b89d04072fb7aa91fb9b42c86c9fb007 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <avahi-common/timeval.h>
 #include <avahi-common/malloc.h>
+#include <avahi-common/error.h>
 
 #include "browse.h"
 #include "log.h"
@@ -98,7 +99,10 @@ static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt
 
 static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
     AvahiSRecordBrowser *b = userdata;
-    struct cbdata cbdata = { b, i };
+    struct cbdata cbdata;
+
+    cbdata.record_browser = b;
+    cbdata.interface = i;
 
     assert(m);
     assert(i);
@@ -122,6 +126,17 @@ static void scan_callback(AvahiTimeEvent *e, void *userdata) {
     }
 }
 
+void avahi_s_record_browser_restart(AvahiSRecordBrowser *b) {
+    assert(b);
+
+    if (!b->scan_time_event) {
+        b->scan_time_event = avahi_time_event_new(b->server->time_event_queue, NULL, scan_callback, b);
+        assert(b->scan_time_event);
+    }
+
+    avahi_server_post_query(b->server, b->interface, b->protocol, b->key);
+}
+
 AvahiSRecordBrowser *avahi_s_record_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key, AvahiSRecordBrowserCallback callback, void* userdata) {
     AvahiSRecordBrowser *b, *t;
     struct timeval tv;