Don't start http server unless user specifies '-h <port>'

This commit is contained in:
Andreas Öman 2007-11-19 21:53:21 +00:00
parent fb21a6bafd
commit 40548fe677
3 changed files with 14 additions and 5 deletions

4
http.c
View file

@ -410,9 +410,9 @@ http_tcp_callback(tcpevent_t event, void *tcpsession)
*/
void
http_start(void)
http_start(int port)
{
tcp_create_server(9980, sizeof(http_connection_t), "http",
tcp_create_server(port, sizeof(http_connection_t), "http",
http_tcp_callback);
}

2
http.h
View file

@ -73,7 +73,7 @@ typedef struct http_connection {
void http_start(void);
void http_start(int port);
void http_arg_flush(struct http_arg_list *list);

13
main.c
View file

@ -51,6 +51,7 @@
#include "rtsp.h"
#include "http.h"
#include "buffer.h"
#include "htmlui.h"
int running;
int xmltvreload;
@ -107,10 +108,11 @@ main(int argc, char **argv)
char *cfgfile = NULL;
int logfacility = LOG_DAEMON;
int disable_dvb = 0;
int http_port = 0;
signal(SIGPIPE, handle_sigpipe);
while((c = getopt(argc, argv, "c:fu:g:d")) != -1) {
while((c = getopt(argc, argv, "c:fu:g:dh:")) != -1) {
switch(c) {
case 'd':
disable_dvb = 1;
@ -127,6 +129,9 @@ main(int argc, char **argv)
case 'g':
groupnam = optarg;
break;
case 'h':
http_port = atoi(optarg);
break;
}
}
@ -187,6 +192,8 @@ main(int argc, char **argv)
subscriptions_init();
htmlui_start();
running = 1;
while(running) {
@ -197,7 +204,9 @@ main(int argc, char **argv)
output_multicast_setup();
client_start();
http_start();
if(http_port)
http_start(http_port);
}
dispatcher();
}