From 4cee342544b5d31022462ba522eed9959ebbd9dd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 28 Jun 2010 23:50:08 +0200 Subject: [PATCH] core: fix counting of workstation services that are in the process of being registered Fixes http://avahi.org/ticket/276 --- avahi-core/iface.c | 9 ++++++--- avahi-core/server.c | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 38dfde1..ad83fe4 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -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); diff --git a/avahi-core/server.c b/avahi-core/server.c index 6c7c4e2..a149f0f 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -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) -- 2.39.5