[polypaudio-commits] r643 - /trunk/src/polypcore/socket-server.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Apr 6 16:28:16 PDT 2006


Author: lennart
Date: Fri Apr  7 01:28:15 2006
New Revision: 643

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=643&root=polypaudio&view=rev
Log:
* set IPV6_V6ONLY for IPv6 sockets, to avoid warning when both ipv6 and the ipv4 sockets try to bind to the same port
* enable SO_REUSEADDR only on platforms that support it

Modified:
    trunk/src/polypcore/socket-server.c

Modified: trunk/src/polypcore/socket-server.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/socket-server.c?rev=643&root=polypaudio&r1=642&r2=643&view=diff
==============================================================================
--- trunk/src/polypcore/socket-server.c (original)
+++ trunk/src/polypcore/socket-server.c Fri Apr  7 01:28:15 2006
@@ -231,8 +231,10 @@
 
     pa_fd_set_cloexec(fd, 1);
 
-    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0)
+#ifdef SO_REUSEADDR
+    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
         pa_log(__FILE__": setsockopt(): %s", strerror(errno));
+#endif
 
     pa_socket_tcp_low_delay(fd);
     
@@ -280,8 +282,15 @@
 
     pa_fd_set_cloexec(fd, 1);
 
-    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0)
-        pa_log(__FILE__": setsockopt(): %s", strerror(errno));
+#ifdef IPV6_V6ONLY
+    if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0)
+        pa_log(__FILE__": setsockopt(IPPROTO_IPV6, IPV6_V6ONLY): %s", strerror(errno));
+#endif
+
+#ifdef SO_REUSEADDR
+    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
+        pa_log(__FILE__": setsockopt(SOL_SOCKET, SO_REUSEADDR, 1): %s", strerror(errno));
+#endif
 
     pa_socket_tcp_low_delay(fd);
 




More information about the pulseaudio-commits mailing list