From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sun, 2 Jan 2022 10:06:36 +0000 (+0000) Subject: Exit with a message in the log if the name to be used for the service is already... X-Git-Tag: 4.1-rc1~24^2~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4322f67fe2066cfc5c96397bbbf40cc40dbc8796;p=thirdparty%2Fshairport-sync.git Exit with a message in the log if the name to be used for the service is already in use. --- diff --git a/mdns_avahi.c b/mdns_avahi.c index 7103b1ee..3dc58565 100644 --- a/mdns_avahi.c +++ b/mdns_avahi.c @@ -242,14 +242,21 @@ static void register_service(AvahiClient *c) { else selected_interface = AVAHI_IF_UNSPEC; if (ap2_text_record_string_list) { - ret = avahi_entry_group_add_service_strlst(group, selected_interface, AVAHI_PROTO_UNSPEC, 0, + ret = avahi_entry_group_add_service_strlst(group, selected_interface, AVAHI_PROTO_UNSPEC, 0, ap2_service_name, config.regtype2, NULL, NULL, port, ap2_text_record_string_list); + if (ret == AVAHI_ERR_COLLISION) { + die("Error: AirPlay 2 name \"%s\" is already in use.", ap2_service_name); + } + } if ((ret == 0) && (text_record_string_list)) { ret = avahi_entry_group_add_service_strlst(group, selected_interface, AVAHI_PROTO_UNSPEC, 0, service_name, config.regtype, NULL, NULL, port, text_record_string_list); + if (ret == AVAHI_ERR_COLLISION) { + die("Error: AirPlay 1 name \"%s\" is already in use.", service_name); + } } if (ret == 0) { ret = avahi_entry_group_commit(group);