Revision 892e86ab

View differences:

conf/janus.transport.http.cfg.sample.in
6 6
; 'unlimited' (which means a thread per connection, as specified by the
7 7
; libmicrohttpd documentation), using a number will make use of a thread
8 8
; pool instead. Since long polls are involved, make sure you choose a
9
; value that doesn't keep new connections waiting.
9
; value that doesn't keep new connections waiting. Notice that by default
10
; all the web servers will try and bind on both IPv4 and IPv6: if you
11
; want to only bind to IPv4 addresses (e.g., because your system does not
12
; support IPv6), you should set the web server 'ip' property to '0.0.0.0'.
10 13
[general]
11 14
json = indented				; Whether the JSON messages should be indented (default),
12 15
							; plain (no indentation) or compact (no indentation and no spaces)
transports/janus_http.c
256 256
	gboolean ipv6 = FALSE;
257 257
	if(ip && strstr(ip, ":"))
258 258
		ipv6 = TRUE;
259
	if(ip || interface) {
260
		gboolean found = FALSE;
259
	gboolean found = FALSE;
260
	if(ip) {
261
		/* Do a quick check to see if we need to bind on all addresses of a specific family */
262
		if(!strcasecmp(ip, "0.0.0.0")) {
263
			/* Bind on all IPv4 addresses */
264
			found = TRUE;
265
			memset(&addr, 0, sizeof (struct sockaddr_in));
266
			addr.sin_family = AF_INET;
267
			addr.sin_port = htons(port);
268
			addr.sin_addr.s_addr = INADDR_ANY;
269
		} else if(!strcasecmp(ip, "::")) {
270
			/* Bind on all IPv6 addresses */
271
			found = TRUE;
272
			memset(&addr6, 0, sizeof (struct sockaddr_in6));
273
			addr6.sin6_family = AF_INET6;
274
			addr6.sin6_port = htons(port);
275
			addr6.sin6_addr = in6addr_any;
276
		}
277
	}
278
	if(!found && (ip || interface)) {
261 279
		struct ifaddrs *ifaddr = NULL, *ifa = NULL;
262 280
		int family = 0, s = 0, n = 0;
263 281
		char host[NI_MAXHOST];

Also available in: Unified diff