]> git.meshlink.io Git - catta/commitdiff
core: fix counting of workstation services that are in the process of being registered
authorLennart Poettering <lennart@poettering.net>
Mon, 28 Jun 2010 21:50:08 +0000 (23:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 28 Jun 2010 21:50:08 +0000 (23:50 +0200)
Fixes http://avahi.org/ticket/276

avahi-core/iface.c
avahi-core/server.c

index 38dfde1bd7850c105e617dbb6177ff335e4e57ee..ad83fe465680da0f4823ef71740595fe990ef8b5 100644 (file)
@@ -90,12 +90,12 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs
             char t[AVAHI_ADDRESS_STR_MAX];
             avahi_address_snprint(t, sizeof(t), &a->address);
 
+            avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
+
             if (avahi_s_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
                 m->server->state == AVAHI_SERVER_REGISTERING)
                 avahi_server_decrease_host_rr_pending(m->server);
 
-            avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
-
             avahi_s_entry_group_reset(a->entry_group);
         }
     }
@@ -151,7 +151,10 @@ void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) {
 
         if (hw->entry_group && !avahi_s_entry_group_is_empty(hw->entry_group)) {
 
-            if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING)
+            avahi_log_info("Withdrawing workstation service for %s.", hw->name);
+
+            if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
+                m->server->state == AVAHI_SERVER_REGISTERING)
                 avahi_server_decrease_host_rr_pending(m->server);
 
             avahi_s_entry_group_reset(hw->entry_group);
index 6c7c4e2ef1b3d42dde6649933a59dba1044ecf82..a149f0fbc68bd68425cd610a9fd9aaac037b476e 100644 (file)
@@ -1215,6 +1215,7 @@ static void register_stuff(AvahiServer *s) {
     register_browse_domain(s);
     avahi_interface_monitor_update_rrs(s->monitor, 0);
 
+    assert(s->n_host_rr_pending > 0);
     s->n_host_rr_pending --;
 
     if (s->n_host_rr_pending == 0)