+ if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
+ return;
+
+ if (r->interface <= 0)
+ r->interface = interface;
+
+ if (r->protocol == AVAHI_PROTO_UNSPEC)
+ r->protocol = protocol;
+
+ if (!r->address_record) {
+ r->address_record = avahi_record_ref(record);
+ r->flags = flags;
+
+ finish(r, AVAHI_RESOLVER_FOUND);
+ }
+
+ break;
+
+ case AVAHI_BROWSER_REMOVE:
+ assert(record);
+ assert(record->key->type == AVAHI_DNS_TYPE_A || record->key->type == AVAHI_DNS_TYPE_AAAA);
+
+ if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
+ avahi_record_unref(r->address_record);
+ r->address_record = NULL;
+
+ r->flags = flags;
+
+
+ /** Look for a replacement */
+ if (r->record_browser_aaaa)
+ avahi_s_record_browser_restart(r->record_browser_aaaa);
+ if (r->record_browser_a)
+ avahi_s_record_browser_restart(r->record_browser_a);
+
+ start_timeout(r);
+ }
+
+ break;
+
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ /* Ignore */
+ break;
+
+ case AVAHI_BROWSER_FAILURE:
+
+ /* Stop browsers */
+
+ if (r->record_browser_aaaa)
+ avahi_s_record_browser_free(r->record_browser_aaaa);
+ if (r->record_browser_a)
+ avahi_s_record_browser_free(r->record_browser_a);
+
+ r->record_browser_a = r->record_browser_aaaa = NULL;
+ r->flags = flags;
+
+ finish(r, AVAHI_RESOLVER_FAILURE);
+ break;
+ }