From 9892815a322aa3e0181d084cc6893119417bc9fd Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 2 Aug 2023 10:12:45 +0200 Subject: [PATCH] dns-sd: Remove duplicates before probing URIs Remove the duplicates in the list of detected URIs before probing those URIs, otherwise we end up with many more connections than necesary. Signed-off-by: Paul Cercueil --- dns_sd_avahi.c | 4 ++-- dns_sd_bonjour.c | 2 +- dns_sd_windows.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dns_sd_avahi.c b/dns_sd_avahi.c index 6535d3f80..bd50c3331 100644 --- a/dns_sd_avahi.c +++ b/dns_sd_avahi.c @@ -293,8 +293,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) avahi_simple_poll_loop(d->poll); if (d->resolved) { - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); } else ret = -ENXIO; @@ -378,8 +378,8 @@ int dnssd_resolve_host(const char *hostname, #endif if (d->resolved) { - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); } else { ret = -ENXIO; goto err_mutex_destroy; diff --git a/dns_sd_bonjour.c b/dns_sd_bonjour.c index ff5a0cb75..f6cef76f1 100644 --- a/dns_sd_bonjour.c +++ b/dns_sd_bonjour.c @@ -238,8 +238,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) } } - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); *ddata = d; } diff --git a/dns_sd_windows.c b/dns_sd_windows.c index 534b1396e..6c7258b85 100644 --- a/dns_sd_windows.c +++ b/dns_sd_windows.c @@ -487,8 +487,8 @@ int dnssd_find_hosts(struct dns_sd_discovery_data **ddata) num_sockets, (num_sockets > 1) ? "s" : "", records, (records > 1) ? "s" : "" ); - port_knock_discovery_data(&d); remove_dup_discovery_data(&d); + port_knock_discovery_data(&d); /* since d may have changed, make sure we pass back the start */ *ddata = d;