diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-08-28 02:11:14 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-08-28 02:11:14 +0000 |
commit | b30495599b156ac933d091bb0cc1ed669c7887b5 (patch) | |
tree | 5db007c94aa532ad2061c30b0dc710ac6a68b1fb | |
parent | 48a87fd98434eb17447e43656dd82f25b35668e5 (diff) |
Don't consider incoming goodbye packets as conflicting unless they match one of our records
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@466 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r-- | avahi-core/server.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/avahi-core/server.c b/avahi-core/server.c index dbb861d..66cc705 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -295,7 +295,30 @@ static int handle_conflict(AvahiServer *s, AvahiInterface *i, AvahiRecord *recor for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = n) { n = e->by_key_next; - if (e->dead || (!(e->flags & AVAHI_ENTRY_UNIQUE) && !unique)) + if (e->dead) + continue; + + /* Check if the incoming is a goodbye record */ + if (avahi_record_is_goodbye(record)) { + + if (avahi_record_equal_no_ttl(e->record, record)) { + char *t; + + /* Refresh */ + t = avahi_record_to_string(record); + avahi_log_debug("Recieved goodbye record for one of our records [%s]. Refreshing.", t); + avahi_server_prepare_matching_responses(s, i, e->record->key, 0); + + valid = 0; + avahi_free(t); + break; + } + + /* If the goodybe packet doesn't match one of our own RRs, we simply ignore it. */ + continue; + } + + if (!(e->flags & AVAHI_ENTRY_UNIQUE) && !unique) continue; /* Either our entry or the other is intended to be unique, so let's check */ |