-
-void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, gboolean goodbye) {
- g_assert(s);
- g_assert(i);
-
-/* avahi_log_debug("goodbye interface: %s.%u", i->hardware->name, i->protocol); */
-
- if (goodbye && avahi_interface_relevant(i)) {
- AvahiEntry *e;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead)
- send_goodbye_callback(s->monitor, i, e);
+
+static void reannounce(AvahiAnnouncer *a) {
+ AvahiEntry *e;
+ struct timeval tv;
+
+ assert(a);
+ e = a->entry;
+
+ /* If the group this entry belongs to is not even commited, there's nothing to reannounce */
+ if (e->group && (e->group->state == AVAHI_ENTRY_GROUP_UNCOMMITED || e->group->state == AVAHI_ENTRY_GROUP_COLLISION))
+ return;
+
+ /* Because we might change state we decrease the probing counter first */
+ if (a->state == AVAHI_PROBING && a->entry->group)
+ a->entry->group->n_probing--;
+
+ if (a->state == AVAHI_PROBING ||
+ (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE)))
+
+ /* We were probing or waiting after probe, so we restart probing from the beginning here */
+
+ a->state = AVAHI_PROBING;
+ else if (a->state == AVAHI_WAITING)
+
+ /* We were waiting, but were not probing before, so we continue waiting */
+ a->state = AVAHI_WAITING;
+
+ else if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
+
+ /* No announcer needed */
+ a->state = AVAHI_ESTABLISHED;
+
+ else {
+
+ /* Ok, let's restart announcing */
+ a->state = AVAHI_ANNOUNCING;