]> git.meshlink.io Git - catta/blobdiff - avahi-core/browse-domain.c
Add missing INTLTOOL_DESKTOP_RULE
[catta] / avahi-core / browse-domain.c
index 4c78832def09ccca253067c25537b02b84b74571..0043806ea97c767ff28e68ab2c1223b2846bdeb2 100644 (file)
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include <avahi-common/domain.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/error.h>
@@ -106,6 +108,8 @@ static void defer_callback(AvahiTimeEvent *e, void *userdata) {
     assert(e);
     assert(b);
 
+    assert(b->type == AVAHI_DOMAIN_BROWSER_BROWSE);
+
     avahi_time_event_free(b->defer_event);
     b->defer_event = NULL;
 
@@ -113,12 +117,12 @@ static void defer_callback(AvahiTimeEvent *e, void *userdata) {
     inc_ref(b);
 
     for (l = b->server->config.browse_domains; l; l = l->next) {
-
+        
         /* Check whether this object still exists outside our own
          * stack frame */
         if (b->ref <= 1)
             break;
-
+        
         b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, b->userdata);
     }
 
@@ -185,6 +189,7 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
     b->record_browser = NULL;
     b->type = type;
     b->all_for_now_scheduled = 0;
+    b->defer_event = NULL;
 
     AVAHI_LLIST_PREPEND(AvahiSDomainBrowser, browser, server->domain_browsers, b);
 
@@ -198,7 +203,8 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
     
     avahi_key_unref(k);
 
-    b->defer_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
+    if (type == AVAHI_DOMAIN_BROWSER_BROWSE && b->server->config.browse_domains)
+        b->defer_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
     
     return b;