Bind IPv4 server first, to avoid v4compat

This commit is contained in:
Julien BLACHE 2010-09-08 19:47:28 +02:00
parent e9b8fd8bd7
commit 0cb62fdabf

View File

@ -1280,10 +1280,6 @@ httpd_init(void)
* as IPv6 might not be supported on the system. * as IPv6 might not be supported on the system.
* We still warn about the failure, in case there's another issue. * We still warn about the failure, in case there's another issue.
*/ */
ret = evhttp_bind_socket(evhttpd, "::", port);
if (ret < 0)
DPRINTF(E_WARN, L_HTTPD, "Could not bind IN6ADDR_ANY:%d (that's OK)\n", port);
ret = evhttp_bind_socket(evhttpd, "0.0.0.0", port); ret = evhttp_bind_socket(evhttpd, "0.0.0.0", port);
if (ret < 0) if (ret < 0)
{ {
@ -1292,6 +1288,10 @@ httpd_init(void)
goto bind_fail; goto bind_fail;
} }
ret = evhttp_bind_socket(evhttpd, "::", port);
if (ret < 0)
DPRINTF(E_WARN, L_HTTPD, "Could not bind IN6ADDR_ANY:%d (that's OK)\n", port);
evhttp_set_gencb(evhttpd, httpd_gen_cb, NULL); evhttp_set_gencb(evhttpd, httpd_gen_cb, NULL);
ret = pthread_create(&tid_httpd, NULL, httpd, NULL); ret = pthread_create(&tid_httpd, NULL, httpd, NULL);