Add commandline option to switch on IPv6 support
This commit is contained in:
parent
8ba3bbdc58
commit
3b758e5ce7
3 changed files with 13 additions and 6 deletions
|
@ -359,7 +359,8 @@ main(int argc, char **argv)
|
|||
opt_debug = 0,
|
||||
opt_syslog = 0,
|
||||
opt_uidebug = 0,
|
||||
opt_abort = 0;
|
||||
opt_abort = 0,
|
||||
opt_ipv6 = 0;
|
||||
const char *opt_config = NULL,
|
||||
*opt_user = NULL,
|
||||
*opt_group = NULL,
|
||||
|
@ -391,8 +392,8 @@ main(int argc, char **argv)
|
|||
{ 'a', "adapters", "Use only specified DVB adapters",
|
||||
OPT_STR, &opt_dvb_adapters },
|
||||
#endif
|
||||
|
||||
{ 0, NULL, "Server Connectivity", OPT_BOOL, NULL },
|
||||
{ '6', "ipv6", "Listen on IPv6", OPT_BOOL, &opt_ipv6 },
|
||||
{ 0, "http_port", "Specify alternative http port",
|
||||
OPT_INT, &tvheadend_webui_port },
|
||||
{ 0, "http_root", "Specify alternative http webroot",
|
||||
|
@ -606,7 +607,7 @@ main(int argc, char **argv)
|
|||
timeshift_init();
|
||||
#endif
|
||||
|
||||
tcp_server_init();
|
||||
tcp_server_init(opt_ipv6);
|
||||
http_server_init();
|
||||
webui_init();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tcp.h"
|
||||
#include "tvheadend.h"
|
||||
|
||||
int tcp_preferred_address_family = AF_INET;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -526,7 +527,7 @@ tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)
|
|||
ressave = res;
|
||||
while(res)
|
||||
{
|
||||
if(res->ai_family == AF_INET6)
|
||||
if(res->ai_family == tcp_preferred_address_family)
|
||||
{
|
||||
use = res;
|
||||
break;
|
||||
|
@ -574,10 +575,13 @@ tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)
|
|||
*
|
||||
*/
|
||||
void
|
||||
tcp_server_init(void)
|
||||
tcp_server_init(int opt_ipv6)
|
||||
{
|
||||
pthread_t tid;
|
||||
|
||||
if(opt_ipv6)
|
||||
tcp_preferred_address_family = AF_INET6;
|
||||
|
||||
tcp_server_epoll_fd = epoll_create(10);
|
||||
pthread_create(&tid, NULL, tcp_server_loop, NULL);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
|
||||
#include "htsbuf.h"
|
||||
|
||||
void tcp_server_init(void);
|
||||
extern int tcp_preferred_address_family;
|
||||
|
||||
void tcp_server_init(int opt_ipv6);
|
||||
|
||||
int tcp_connect(const char *hostname, int port, char *errbuf,
|
||||
size_t errbufsize, int timeout);
|
||||
|
|
Loading…
Add table
Reference in a new issue