From: Jaroslav Kysela Date: Wed, 29 Nov 2017 09:56:46 +0000 (+0100) Subject: avahi/bonjour: fix thinkos and typos X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ae2640ddd7ef91fdb06fd31b546802b7bdc8a8e;p=thirdparty%2Ftvheadend.git avahi/bonjour: fix thinkos and typos --- diff --git a/src/avahi.c b/src/avahi.c index 2b65cf101..55e111de7 100644 --- a/src/avahi.c +++ b/src/avahi.c @@ -65,7 +65,7 @@ static void create_services(AvahiClient *c); static inline int avahi_required(void) { - return http_webui_port > 0 || tvheadend_htsp_port > 0; + return tvheadend_webui_port > 0 || tvheadend_htsp_port > 0; } static void diff --git a/src/bonjour.c b/src/bonjour.c index e6e48315e..3ca25bfed 100644 --- a/src/bonjour.c +++ b/src/bonjour.c @@ -33,12 +33,6 @@ typedef struct { pthread_t bonjour_tid; CFNetServiceRef svc_http, svc_htsp; -static inline int -bonjour_required(void) -{ - return http_webui_port > 0 || tvheadend_htsp_port > 0; -} - static void bonjour_callback(CFNetServiceRef theService, CFStreamError* error, void* info) { @@ -114,19 +108,19 @@ bonjour_init(void) { .key = NULL } }; - if (!bonjour_required()) - return; - bonjour_start_service(&svc_http, "_http._tcp", tvheadend_webui_port, - txt_rec_http); + if (tvheadend_webui_port > 0) + bonjour_start_service(&svc_http, "_http._tcp", tvheadend_webui_port, + txt_rec_http); - bonjour_start_service(&svc_htsp, "_htsp._tcp", tvheadend_htsp_port, NULL); + if (tvheadend_htsp_port > 0) + bonjour_start_service(&svc_htsp, "_htsp._tcp", tvheadend_htsp_port, NULL); } void bonjour_done(void) { - if (!bonjour_required()) - return; - bonjour_stop_service(&svc_http); - bonjour_stop_service(&svc_htsp); + if (tvheadend_webui_port > 0) + bonjour_stop_service(&svc_http); + if (tvheadend_htsp_port > 0) + bonjour_stop_service(&svc_htsp); }