[mdns] Remove ipv4/ipv6 argument to mdns_browse

Make sure mdns_browse() always works the same, and follows user config.
This commit is contained in:
ejurgensen
2021-02-26 22:16:04 +01:00
parent 7871d71a9c
commit dd0f0ece78
7 changed files with 23 additions and 33 deletions

View File

@@ -52,6 +52,7 @@
#endif
#include "logger.h"
#include "conffile.h"
#include "mdns.h"
#define MDNSERR avahi_strerror(avahi_client_errno(mdns_client))
@@ -1160,15 +1161,21 @@ mdns_cname(char *name)
}
int
mdns_browse(char *type, int family, mdns_browse_cb cb, enum mdns_options flags)
mdns_browse(char *type, mdns_browse_cb cb, enum mdns_options flags)
{
struct mdns_browser *mb;
AvahiServiceBrowser *b;
int family;
DPRINTF(E_DBG, L_MDNS, "Adding service browser for type %s\n", type);
CHECK_NULL(L_MDNS, mb = calloc(1, sizeof(struct mdns_browser)));
if (flags & MDNS_IPV4ONLY || !cfg_getbool(cfg_getsec(cfg, "general"), "ipv6"))
family = AF_INET;
else
family = AF_UNSPEC;
mb->protocol = avahi_af_to_proto(family);
mb->type = strdup(type);
mb->flags = flags;