X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fannounce.c;h=87966211e68f22234be76084426d051b49b76195;hb=9ca377e8bc8ef73714180143c24223016acbc845;hp=025331d0b43249eb054b26112a8d95c623f69728;hpb=424aefe8a431b79496672799dc4f4430fa935252;p=catta diff --git a/avahi-core/announce.c b/avahi-core/announce.c index 025331d..8796621 100644 --- a/avahi-core/announce.c +++ b/avahi-core/announce.c @@ -391,6 +391,26 @@ static AvahiRecord *make_goodbye_record(AvahiRecord *r) { return g; } +static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) { + AvahiEntry *i; + + assert(s); + assert(e); + + for (i = avahi_hashmap_lookup(s->entries_by_key, e->record->key); i; i = i->by_key_next) { + + if (i == e) + continue; + + if (!avahi_record_equal_no_ttl(i->record, e->record)) + continue; + + return 1; + } + + return 0; +} + static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) { AvahiEntry *e = userdata; AvahiRecord *g; @@ -408,6 +428,9 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v if (!avahi_entry_is_registered(m->server, e, i)) return; + + if (is_duplicate_entry(m->server, e)) + return; if (!(g = make_goodbye_record(e->record))) return; /* OOM */ @@ -422,7 +445,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int goodbye) { /* avahi_log_debug("goodbye interface: %s.%u", i->hardware->name, i->protocol); */ - if (goodbye && avahi_interface_relevant(i)) { + if (goodbye && avahi_interface_is_relevant(i)) { AvahiEntry *e; for (e = s->entries; e; e = e->entries_next)