do use reuseaddr on non-W32 systems
authorChristian Grothoff <christian@grothoff.org>
Fri, 16 Sep 2011 12:55:01 +0000 (12:55 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 16 Sep 2011 12:55:01 +0000 (12:55 +0000)
src/util/network.c

index e071b8b54f95ebbcf92b72b9d310183e2260a6c8..65016bbcd2907cac29873ed78c146999988c7e30 100644 (file)
@@ -285,12 +285,12 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
   if (desc->af == AF_INET6)
     if (0 != setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on)))
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
-#if 0
-  /* is this needed or desired? or done elsewhere? */
-  if (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
 #endif
 #endif
+#ifndef WINDOWS
+  /* This is required, and required here, but only on UNIX */
+  if (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
 #endif
 #ifndef LINUX
 #ifndef MINGW