X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fserver.c;h=5790beed77195ba53bcd8f97d38cda478f24919b;hb=da75d1898a45c106a994cd87f8da5b6bcb2b6450;hp=e42692f198860bb1a573a9aeee1ad7f03fb5a67f;hpb=55357e3c75438ce83553d1c43d47e53eb7919d74;p=catta diff --git a/avahi-core/server.c b/avahi-core/server.c index e42692f..5790bee 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -404,15 +404,25 @@ void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsP int tc = p && !!(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC); while ((r = avahi_record_list_next(s->record_list, &flush_cache, &unicast_response, &auxiliary))) { - - if (!avahi_interface_post_response(i, r, flush_cache, a, immediately || (flush_cache && !tc && !auxiliary)) && unicast_response) { - append_aux_records_to_list(s, i, r, unicast_response); - + int im = immediately; + + /* Only send the response immediately if it contains a + * unique entry AND it is not in reply to a truncated + * packet AND it is not an auxiliary record AND all other + * responses for this record are unique too. */ + + if (flush_cache && !tc && !auxiliary && avahi_record_list_all_flush_cache(s->record_list)) + im = 1; + + if (!avahi_interface_post_response(i, r, flush_cache, a, im) && unicast_response) { + /* Due to some reasons the record has not been scheduled. * The client requested an unicast response in that * case. Therefore we prepare such a response */ + append_aux_records_to_list(s, i, r, unicast_response); + for (;;) { if (!reply) { @@ -517,7 +527,7 @@ static void reflect_query(AvahiServer *s, AvahiInterface *i, AvahiKey *k) { for (j = s->monitor->interfaces; j; j = j->interface_next) if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol)) { /* Post the query to other networks */ - avahi_interface_post_query(j, k, 1); + avahi_interface_post_query(j, k, 1, NULL); /* Reply from caches of other network. This is needed to * "work around" known answer suppression. */ @@ -1141,7 +1151,7 @@ static void register_hinfo(AvahiServer *s) { r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine)); r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname)); - avahi_log_info("Adding HINFO record with values '%s/%s'", r->data.hinfo.cpu, r->data.hinfo.os); + avahi_log_info("Registering HINFO record with values '%s'/'%s'.", r->data.hinfo.cpu, r->data.hinfo.os); if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) { avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));