gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28664 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r28664 - gnunet/src/util
Date: Thu, 15 Aug 2013 17:46:39 +0200

Author: harsha
Date: 2013-08-15 17:46:39 +0200 (Thu, 15 Aug 2013)
New Revision: 28664

Modified:
   gnunet/src/util/network.c
Log:
- use SO_REUSEADDR for SOCK_STREAM type sockets only


Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c   2013-08-15 14:20:50 UTC (rev 28663)
+++ gnunet/src/util/network.c   2013-08-15 15:46:39 UTC (rev 28664)
@@ -54,6 +54,11 @@
   int af;
 
   /**
+   * Type of the socket
+   */
+  int type;
+
+  /**
    * Number of bytes in addr.
    */
   socklen_t addrlen;
@@ -290,6 +295,7 @@
                           int af, int type)
 {
   h->af = af;
+  h->type = type;
   if (h->fd == INVALID_SOCKET)
   {
 #ifdef MINGW
@@ -398,8 +404,9 @@
   {
     const int on = 1;
   
-    /* This is required, and required here, but only on UNIX */
-    if (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))
+    /* This is required here for TCP sockets, but only on UNIX */
+    if ((SOCK_STREAM == desc->type) 
+        && (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof 
(on))))
       LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
   }
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]