diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-10-10 22:59:08 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-10-10 22:59:08 +0000 |
commit | d78f83f7b671523f45a2cfcf03f8e714c8908008 (patch) | |
tree | 9046e0bc43107083232e88ab793def13ac1adb50 /avahi-core/announce.c | |
parent | d0a346a0d5959f7286f6c3f4734153aceb307aae (diff) |
don't send goodbye packets for records that are referenced from two local entries
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@712 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/announce.c')
-rw-r--r-- | avahi-core/announce.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/avahi-core/announce.c b/avahi-core/announce.c index 025331d..33d52aa 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 */ |