fail:
avahi_record_list_flush(s->record_list);
-
}
static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a) {
avahi_record_unref(record);
}
+
+ /* If the incoming response contained a conflicting record, some
+ records have been scheduling for sending. We need to flush them
+ here. */
+ if (!avahi_record_list_empty(s->record_list))
+ avahi_server_generate_response(s, i, NULL, NULL, 0, FALSE);
}
static AvahiLegacyUnicastReflectSlot* allocate_slot(AvahiServer *s) {
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path, UNIX_SOCKET, sizeof(sa.sun_path)-1);
+ /* We simply remove existing UNIX sockets under this name. The
+ Avahi daemons makes sure that it runs only once on a host,
+ therefore sockets that already exist are stale and may be
+ removed without any ill effects */
+
+ unlink(UNIX_SOCKET);
+
if (bind(server->fd, &sa, sizeof(sa)) < 0) {
avahi_log_warn("bind(): %s", strerror(errno));
goto fail;