Added in webui_port and htsp_port for parameters to listen on different ports. Fixes #804 and PR-118.

This commit is contained in:
Andy Brown 2012-08-24 15:54:24 +01:00 committed by Adam Sutton
parent 1d15fb9614
commit 8e3336ff34
5 changed files with 20 additions and 5 deletions

View file

@ -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) {

View file

@ -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);
}
/**

View file

@ -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);
}

View file

@ -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 <portnumber> WebUI access port [default 9981]\n");
printf(" -e <portnumber> 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;

View file

@ -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;