Skip to content

Commit

Permalink
dns-sd: Remove duplicates before probing URIs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pcercuei committed Aug 2, 2023
1 parent bbbbc42 commit 9892815
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dns_sd_avahi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dns_sd_bonjour.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion dns_sd_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9892815

Please sign in to comment.