From: Andy Brown Date: Fri, 24 Aug 2012 14:54:24 +0000 (+0100) Subject: Added in webui_port and htsp_port for parameters to listen on different ports. Fixes... X-Git-Tag: 3.3~121 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e3336ff349ab46815fd80d6dc73e5481bd69f5e;p=thirdparty%2Ftvheadend.git Added in webui_port and htsp_port for parameters to listen on different ports. Fixes #804 and PR-118. --- diff --git a/src/avahi.c b/src/avahi.c index 4dc14f32b..af66db26c 100644 --- a/src/avahi.c +++ b/src/avahi.c @@ -133,7 +133,7 @@ create_services(AvahiClient *c) /* Add the service for HTSP */ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, - "_htsp._tcp", NULL, NULL, 9982, + "_htsp._tcp", NULL, NULL,htsp_port, NULL)) < 0) { if (ret == AVAHI_ERR_COLLISION) @@ -149,7 +149,7 @@ create_services(AvahiClient *c) /* Add the service for HTTP */ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, - "_http._tcp", NULL, NULL, 9981, + "_http._tcp", NULL, NULL, webui_port, "path=/", NULL)) < 0) { diff --git a/src/htsp.c b/src/htsp.c index 9948bbbf4..7edce4a67 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -1384,7 +1384,7 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source, void htsp_init(void) { - htsp_server = tcp_server_create(9982, htsp_serve, NULL); + htsp_server = tcp_server_create(htsp_port, htsp_serve, NULL); } /** diff --git a/src/http.c b/src/http.c index f56f5f22f..6a39f3b47 100644 --- a/src/http.c +++ b/src/http.c @@ -809,5 +809,5 @@ http_serve(int fd, void *opaque, struct sockaddr_in *peer, void http_server_init(void) { - http_server = tcp_server_create(9981, http_serve, NULL); + http_server = tcp_server_create(webui_port, http_serve, NULL); } diff --git a/src/main.c b/src/main.c index 102cd0d07..66d863fc3 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,8 @@ static int log_decorate; int log_debug_to_syslog; int log_debug_to_console; +int webui_port; +int htsp_port; char *tvheadend_cwd; static void @@ -184,6 +186,8 @@ usage(const char *argv0) " to your Tvheadend installation until you edit\n" " the access-control from within the Tvheadend UI\n"); printf(" -s Log debug to syslog\n"); + printf(" -w WebUI access port [default 9981]\n"); + printf(" -e HTSP access port [default 9982]\n"); printf("\n"); printf("Development options\n"); printf("\n"); @@ -262,6 +266,8 @@ main(int argc, char **argv) char *p, *endp; uint32_t adapter_mask = 0xffffffff; int crash = 0; + webui_port = 9981; + htsp_port = 9982; /* Get current directory */ tvheadend_cwd = dirname(dirname(strdup(argv[0]))); @@ -272,7 +278,7 @@ main(int argc, char **argv) // make sure the timezone is set tzset(); - while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:s")) != -1) { + while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:sw:e:")) != -1) { switch(c) { case 'a': adapter_mask = 0x0; @@ -303,6 +309,12 @@ main(int argc, char **argv) case 'p': pidpath = optarg; break; + case 'w': + webui_port = atoi(optarg); + break; + case 'e': + htsp_port = atoi(optarg); + break; case 'u': usernam = optarg; break; diff --git a/src/tvheadend.h b/src/tvheadend.h index f1abf7781..8d86ba51e 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -43,6 +43,9 @@ extern pthread_mutex_t global_lock; extern pthread_mutex_t ffmpeg_lock; extern pthread_mutex_t fork_lock; +extern int webui_port; +extern int htsp_port; + typedef struct source_info { char *si_device; char *si_adapter;