gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9163 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r9163 - in gnunet/src: include util
Date: Sat, 17 Oct 2009 14:47:30 -0600

Author: grothoff
Date: 2009-10-17 14:47:30 -0600 (Sat, 17 Oct 2009)
New Revision: 9163

Modified:
   gnunet/src/include/gnunet_network_lib.h
   gnunet/src/util/connection.c
   gnunet/src/util/network.c
   gnunet/src/util/server.c
   gnunet/src/util/service.c
   gnunet/src/util/test_connection.c
   gnunet/src/util/test_connection_addressing.c
   gnunet/src/util/test_connection_receive_cancel.c
   gnunet/src/util/test_connection_timeout.c
   gnunet/src/util/test_service.c
Log:
making flags, set non-blocking and set-inheritable internal issues of network.c

Modified: gnunet/src/include/gnunet_network_lib.h
===================================================================
--- gnunet/src/include/gnunet_network_lib.h     2009-10-17 20:13:50 UTC (rev 
9162)
+++ gnunet/src/include/gnunet_network_lib.h     2009-10-17 20:47:30 UTC (rev 
9163)
@@ -51,8 +51,11 @@
 #include "gnunet_disk_lib.h"
 #include "gnunet_time_lib.h"
 
+
 /**
- * accept a new connection on a socket
+ * Accept a new connection on a socket.  Configure it for non-blocking
+ * IO and mark it as non-inheritable to child processes (set the
+ * close-on-exec flag).
  *
  * @param desc bound socket
  * @param address address of the connecting peer, may be NULL
@@ -64,17 +67,6 @@
                              struct sockaddr *address,
                              socklen_t *address_len);
 
-/**
- * Make a non-inheritable to child processes (sets the
- * close-on-exec flag).
- *
- * @param h the socket to make non-inheritable
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
- * @warning Not implemented on Windows
- */
-int
-GNUNET_NETWORK_socket_set_inheritable (const struct GNUNET_NETWORK_Handle
-                                       *h);
 
 /**
  * Bind to a connected socket
@@ -88,7 +80,7 @@
                     const struct sockaddr *address, socklen_t address_len);
 
 /**
- * Close a socket
+ * Close a socket.
  *
  * @param desc socket to close
  * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
@@ -132,16 +124,15 @@
 int GNUNET_NETWORK_socket_listen (const struct GNUNET_NETWORK_Handle *desc, 
int backlog);
 
 /**
- * Read data from a connected socket
+ * Read data from a connected socket (always non-blocking).
  *
  * @param desc socket
  * @param buffer buffer
  * @param length length of buffer
- * @param flags type of message reception
  * @return number of bytes read
  */
 ssize_t GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle *desc, 
void *buffer,
-                        size_t length, int flags);
+                                   size_t length);
 
 /**
  * Check if sockets meet certain conditions
@@ -155,38 +146,32 @@
     struct GNUNET_NETWORK_FDSet *wfds, struct GNUNET_NETWORK_FDSet *efds,
     struct GNUNET_TIME_Relative timeout);
 
-/**
- * Set if a socket should use blocking or non-blocking IO.
- * @param fd socket
- * @param doBlock blocking mode
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd, 
-                                       int doBlock);
 
+
 /**
- * Send data
+ * Send data (always non-blocking).
+ *
  * @param desc socket
  * @param buffer data to send
  * @param length size of the buffer
- * @param flags type of message transmission
  * @return number of bytes sent, GNUNET_SYSERR on error
  */
 ssize_t GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle *desc,
-                        const void *buffer, size_t length, int flags);
+                        const void *buffer, size_t length);
 
 /**
- * Send data
+ * Send data to a particular destination (always non-blocking).
+ * This function only works for UDP sockets.
+ *
  * @param desc socket
  * @param message data to send
  * @param length size of the data
- * @param flags type of message transmission
  * @param dest_addr destination address
  * @param dest_len length of address
  * @return number of bytes sent, GNUNET_SYSERR on error
  */
 ssize_t GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle *desc,
-                          const void *message, size_t length, int flags,
+                          const void *message, size_t length, 
                           const struct sockaddr *dest_addr,
                           socklen_t dest_len);
 
@@ -210,14 +195,18 @@
  */
 int GNUNET_NETWORK_socket_shutdown (struct GNUNET_NETWORK_Handle *desc, int 
how);
 
+
 /**
- * Create a new socket
+ * Create a new socket.   Configure it for non-blocking IO and
+ * mark it as non-inheritable to child processes (set the
+ * close-on-exec flag).
+ *
  * @param domain domain of the socket
  * @param type socket type
  * @param protocol network protocol
  * @return new socket, NULL on error
  */
-struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_socket (int domain, int 
type, int protocol);
+struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_create (int domain, int 
type, int protocol);
 
 /**
  * Reset FD set (clears all file descriptors).

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/connection.c        2009-10-17 20:47:30 UTC (rev 9163)
@@ -342,11 +342,6 @@
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "accept");
       return NULL;
     }
-#ifndef MINGW
-  if (GNUNET_OK != GNUNET_NETWORK_socket_set_inheritable (sock))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                         "fcntl");
-#endif
   if (addrlen > sizeof (addr))
     {
       GNUNET_break (0);
@@ -797,25 +792,12 @@
       GNUNET_free (ap);
       return; /* not supported by us */
     }
-  ap->sock = GNUNET_NETWORK_socket_socket (ap->addr->sa_family, SOCK_STREAM, 
0);
+  ap->sock = GNUNET_NETWORK_socket_create (ap->addr->sa_family, SOCK_STREAM, 
0);
   if (ap->sock == NULL)
     {
       GNUNET_free (ap);
       return; /* not supported by OS */
     }
-#ifndef MINGW
-  if (GNUNET_OK != GNUNET_NETWORK_socket_set_inheritable (ap->sock))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                        "GNUNET_NETWORK_socket_set_inheritable");
-#endif
-  if (GNUNET_SYSERR == GNUNET_NETWORK_socket_set_blocking (ap->sock, 
GNUNET_NO))
-    {
-      /* we might want to treat this one as fatal... */
-      GNUNET_break (0);
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ap->sock));
-      GNUNET_free (ap);
-      return; 
-    }
 #if DEBUG_CONNECTION
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
              _("Trying to connect to `%s' (%p)\n"),
@@ -932,27 +914,13 @@
   struct GNUNET_NETWORK_Handle *s;
   struct GNUNET_CONNECTION_Handle *ret;
 
-  s = GNUNET_NETWORK_socket_socket (af_family, SOCK_STREAM, 0);
+  s = GNUNET_NETWORK_socket_create (af_family, SOCK_STREAM, 0);
   if (s == NULL)
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
                            GNUNET_ERROR_TYPE_BULK, "socket");
       return NULL;
     }
-#ifndef MINGW
-#if 0
-  // FIXME NILS
-  if (0 != fcntl (s, F_SETFD, fcntl (s, F_GETFD) | FD_CLOEXEC))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                         "fcntl");
-#endif
-#endif
-  if (GNUNET_SYSERR == GNUNET_NETWORK_socket_set_blocking (s, GNUNET_NO))
-    {
-      /* we'll treat this one as fatal */
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s));
-      return NULL;
-    }
   if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (s, serv_addr, addrlen)) && 
(errno != EINPROGRESS))
     {
       /* maybe refused / unsupported address, try next */
@@ -1093,14 +1061,7 @@
     }
   GNUNET_assert (GNUNET_NETWORK_fdset_isset (tc->read_ready, sh->sock));
 RETRY:
-  ret = GNUNET_NETWORK_socket_recv (sh->sock, buffer, sh->max,
-#ifndef MINGW
-      // FIXME MINGW
-      MSG_DONTWAIT
-#else
-      0
-#endif
-      );
+  ret = GNUNET_NETWORK_socket_recv (sh->sock, buffer, sh->max);
   if (ret == -1)
     {
       if (errno == EINTR)
@@ -1418,14 +1379,7 @@
 RETRY:
   ret = GNUNET_NETWORK_socket_send (sock->sock,
                                    &sock->write_buffer[sock->write_buffer_pos],
-                                   have,
-#ifndef MINGW
-              // FIXME NILS
-              MSG_DONTWAIT | MSG_NOSIGNAL
-#else
-              0
-#endif
-  );
+                                   have);
   if (ret == -1)
     {
       if (errno == EINTR)

Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c   2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/network.c   2009-10-17 20:47:30 UTC (rev 9163)
@@ -55,7 +55,76 @@
 #define FD_COPY(s, d) (memcpy ((d), (s), sizeof (fd_set)))
 #endif
 
+
+
 /**
+ * Set if a socket should use blocking or non-blocking IO.
+ * @param fd socket
+ * @param doBlock blocking mode
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+static int
+socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
+                    int doBlock)
+{
+#if MINGW
+  u_long mode;
+  mode = !doBlock;
+  if (ioctlsocket (fd->fd, FIONBIO, &mode) == SOCKET_ERROR)
+    {
+      SetErrnoFromWinsockError (WSAGetLastError ());
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "ioctlsocket");
+      return GNUNET_SYSERR;
+    }
+  return GNUNET_OK;
+
+#else
+  /* not MINGW */
+  int flags = fcntl (fd->fd, F_GETFL);
+  if (flags == -1)
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
+      return GNUNET_SYSERR;
+    }
+  if (doBlock)
+    flags &= ~O_NONBLOCK;
+  else
+    flags |= O_NONBLOCK;
+  if (0 != fcntl (fd->fd, F_SETFL, flags))
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
+      return GNUNET_SYSERR;
+    }
+  return GNUNET_OK;
+#endif
+}
+
+
+#ifndef MINGW
+/**
+ * Make a non-inheritable to child processes
+ *
+ * @param h the socket to make non-inheritable
+ * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @warning Not implemented on Windows
+ */
+static int
+socket_set_inheritable (const struct GNUNET_NETWORK_Handle
+                                       *h)
+{
+  int i;
+
+  i = fcntl (h->fd, F_GETFD);
+  if (i == (i | FD_CLOEXEC))
+    return GNUNET_OK;
+  return (fcntl (h->fd, F_SETFD, i | FD_CLOEXEC) == 0)
+    ? GNUNET_OK : GNUNET_SYSERR;
+}
+#endif
+
+
+
+/**
  * accept a new connection on a socket
  *
  * @param desc bound socket
@@ -89,6 +158,18 @@
       return NULL;
     }
 #endif
+  if (GNUNET_SYSERR == socket_set_blocking (ret, GNUNET_NO))
+    {
+      /* we might want to treat this one as fatal... */
+      GNUNET_break (0);
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ret));
+      return NULL; 
+    }
+#ifndef MINGW
+  if (GNUNET_OK != socket_set_inheritable (ret))
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+                        "socket_set_inheritable");
+#endif
   return ret;
 }
 
@@ -114,48 +195,7 @@
   return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
 }
 
-/**
- * Set if a socket should use blocking or non-blocking IO.
- * @param fd socket
- * @param doBlock blocking mode
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int
-GNUNET_NETWORK_socket_set_blocking (struct GNUNET_NETWORK_Handle *fd,
-                                    int doBlock)
-{
-#if MINGW
-  u_long mode;
-  mode = !doBlock;
-  if (ioctlsocket (fd->fd, FIONBIO, &mode) == SOCKET_ERROR)
-    {
-      SetErrnoFromWinsockError (WSAGetLastError ());
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "ioctlsocket");
-      return GNUNET_SYSERR;
-    }
-  return GNUNET_OK;
 
-#else
-  /* not MINGW */
-  int flags = fcntl (fd->fd, F_GETFL);
-  if (flags == -1)
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
-      return GNUNET_SYSERR;
-    }
-  if (doBlock)
-    flags &= ~O_NONBLOCK;
-  else
-    flags |= O_NONBLOCK;
-  if (0 != fcntl (fd->fd, F_SETFL, flags))
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
-      return GNUNET_SYSERR;
-    }
-  return GNUNET_OK;
-#endif
-}
-
 /**
  * Close a socket
  * @param desc socket
@@ -207,6 +247,7 @@
 
 /**
  * Get socket options
+ *
  * @param desc socket
  * @param level protocol level of the option
  * @param optname identifier of the option
@@ -253,18 +294,22 @@
 }
 
 /**
- * Read data from a connected socket
+ * Read data from a connected socket (always non-blocking).
  * @param desc socket
  * @param buffer buffer
  * @param length length of buffer
- * @param flags type of message reception
  */
 ssize_t
 GNUNET_NETWORK_socket_recv (const struct GNUNET_NETWORK_Handle * desc,
-                            void *buffer, size_t length, int flags)
+                            void *buffer, size_t length)
 {
   int ret;
+  int flags;
 
+  flags = 0;
+#ifdef MSG_DONTWAIT
+  flags |= MSG_DONTWAIT;
+#endif
   ret = recv (desc->fd, buffer, length, flags);
 #ifdef MINGW
   if (SOCKET_ERROR == ret)
@@ -275,19 +320,27 @@
 }
 
 /**
- * Send data
+ * Send data (always non-blocking).
+ *
  * @param desc socket
  * @param buffer data to send
  * @param length size of the buffer
- * @param flags type of message transmission
  * @return number of bytes sent, GNUNET_SYSERR on error
  */
 ssize_t
 GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle * desc,
-                            const void *buffer, size_t length, int flags)
+                            const void *buffer, size_t length)
 {
   int ret;
+  int flags;
 
+  flags = 0;
+#ifdef MSG_DONTWAIT
+  flags |= MSG_DONTWAIT;
+#endif
+#ifdef MSG_NOSIGNAL
+  flags |= MSG_NOSIGNAL;
+#endif
   ret = send (desc->fd, buffer, length, flags);
 #ifdef MINGW
   if (SOCKET_ERROR == ret)
@@ -297,24 +350,34 @@
   return ret;
 }
 
+
 /**
- * Send data
+ * Send data to a particular destination (always non-blocking).
+ * This function only works for UDP sockets.
+ *
  * @param desc socket
  * @param message data to send
  * @param length size of the data
- * @param flags type of message transmission
  * @param dest_addr destination address
  * @param dest_len length of address
  * @return number of bytes sent, GNUNET_SYSERR on error
  */
 ssize_t
 GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle * desc,
-                              const void *message, size_t length, int flags,
+                              const void *message, size_t length,
                               const struct sockaddr * dest_addr,
                               socklen_t dest_len)
 {
   int ret;
+  int flags;
 
+  flags = 0;
+#ifdef MSG_DONTWAIT
+  flags |= MSG_DONTWAIT;
+#endif
+#ifdef MSG_NOSIGNAL
+  flags |= MSG_NOSIGNAL;
+#endif
   ret = sendto (desc->fd, message, length, flags, dest_addr, dest_len);
 #ifdef MINGW
   if (SOCKET_ERROR == ret)
@@ -350,15 +413,20 @@
   return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
 }
 
+
+
 /**
- * Create a new socket
+ * Create a new socket.  Configure it for non-blocking IO and
+ * mark it as non-inheritable to child processes (set the
+ * close-on-exec flag).
+ *
  * @param domain domain of the socket
  * @param type socket type
  * @param protocol network protocol
  * @return new socket, NULL on error
  */
 struct GNUNET_NETWORK_Handle *
-GNUNET_NETWORK_socket_socket (int domain, int type, int protocol)
+GNUNET_NETWORK_socket_create (int domain, int type, int protocol)
 {
   struct GNUNET_NETWORK_Handle *ret;
 
@@ -381,6 +449,20 @@
       return NULL;
     }
 #endif
+
+  if (GNUNET_SYSERR == socket_set_blocking (ret, GNUNET_NO))
+    {
+      /* we might want to treat this one as fatal... */
+      GNUNET_break (0);
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ret));
+      return NULL; 
+    }
+#ifndef MINGW
+  if (GNUNET_OK != socket_set_inheritable (ret))
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+                        "socket_set_inheritable");
+#endif
+
   return ret;
 }
 
@@ -405,32 +487,7 @@
   return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
 }
 
-/**
- * Make a non-inheritable to child processes
- *
- * @param h the socket to make non-inheritable
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
- * @warning Not implemented on Windows
- */
-int
-GNUNET_NETWORK_socket_set_inheritable (const struct GNUNET_NETWORK_Handle
-                                       *h)
-{
-#ifdef MINGW
-  errno = ENOSYS;
-  return GNUNET_SYSERR;
-#else
-  int i;
 
-  i = fcntl (h->fd, F_GETFD);
-  if (i == (i | FD_CLOEXEC))
-    return GNUNET_OK;
-  return (fcntl (h->fd, F_SETFD, i | FD_CLOEXEC) == 0)
-    ? GNUNET_OK : GNUNET_SYSERR;
-#endif
-}
-
-
 /**
  * Reset FD set
  * @param fds fd set

Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c    2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/server.c    2009-10-17 20:47:30 UTC (rev 9163)
@@ -382,17 +382,12 @@
       GNUNET_break (0);
       return NULL;
     }
-  sock = GNUNET_NETWORK_socket_socket (serverAddr->sa_family, SOCK_STREAM, 0);
+  sock = GNUNET_NETWORK_socket_create (serverAddr->sa_family, SOCK_STREAM, 0);
   if (NULL == sock)
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
       return NULL;
     }
-#ifndef MINGW
-  if (GNUNET_OK != GNUNET_NETWORK_socket_set_inheritable (sock))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                         "fcntl");
-#endif
   if (GNUNET_NETWORK_socket_setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof (on)) != GNUNET_OK)
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                          "setsockopt");

Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c   2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/service.c   2009-10-17 20:47:30 UTC (rev 9163)
@@ -815,7 +815,7 @@
   if (!disablev6)
     {
       /* probe IPv6 support */
-      desc = GNUNET_NETWORK_socket_socket (PF_INET6, SOCK_STREAM, 0);
+      desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
       if (NULL == desc)
         {
           if ((errno == ENOBUFS) ||

Modified: gnunet/src/util/test_connection.c
===================================================================
--- gnunet/src/util/test_connection.c   2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/test_connection.c   2009-10-17 20:47:30 UTC (rev 9163)
@@ -62,7 +62,7 @@
 #endif
   sa.sin_port = htons (PORT);
   sa.sin_family = AF_INET;
-  desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
+  desc = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
   GNUNET_assert (desc != NULL);
   if (GNUNET_NETWORK_socket_setsockopt (desc, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof (on)) != GNUNET_OK)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,

Modified: gnunet/src/util/test_connection_addressing.c
===================================================================
--- gnunet/src/util/test_connection_addressing.c        2009-10-17 20:13:50 UTC 
(rev 9162)
+++ gnunet/src/util/test_connection_addressing.c        2009-10-17 20:47:30 UTC 
(rev 9163)
@@ -61,7 +61,7 @@
   sa.sin_len = sizeof (sa);
 #endif
   sa.sin_port = htons (PORT);
-  desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
+  desc = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
   GNUNET_assert (desc != 0);
   if (GNUNET_NETWORK_socket_setsockopt (desc, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof (on)) != GNUNET_OK)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,

Modified: gnunet/src/util/test_connection_receive_cancel.c
===================================================================
--- gnunet/src/util/test_connection_receive_cancel.c    2009-10-17 20:13:50 UTC 
(rev 9162)
+++ gnunet/src/util/test_connection_receive_cancel.c    2009-10-17 20:47:30 UTC 
(rev 9163)
@@ -60,7 +60,7 @@
   sa.sin_len = sizeof (sa);
 #endif
   sa.sin_port = htons (PORT);
-  desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
+  desc = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
   GNUNET_assert (desc != NULL);
   if (GNUNET_NETWORK_socket_setsockopt (desc, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof (on)) != GNUNET_OK)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,

Modified: gnunet/src/util/test_connection_timeout.c
===================================================================
--- gnunet/src/util/test_connection_timeout.c   2009-10-17 20:13:50 UTC (rev 
9162)
+++ gnunet/src/util/test_connection_timeout.c   2009-10-17 20:47:30 UTC (rev 
9163)
@@ -57,7 +57,7 @@
   sa.sin_len = sizeof (sa);
 #endif
   sa.sin_port = htons (PORT);
-  desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
+  desc = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
   GNUNET_assert (desc != NULL);
   if (GNUNET_NETWORK_socket_setsockopt (desc, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof (on)) != GNUNET_OK)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,

Modified: gnunet/src/util/test_service.c
===================================================================
--- gnunet/src/util/test_service.c      2009-10-17 20:13:50 UTC (rev 9162)
+++ gnunet/src/util/test_service.c      2009-10-17 20:47:30 UTC (rev 9163)
@@ -311,7 +311,7 @@
                     NULL);
   ret += check ();
   ret += check ();
-  s = GNUNET_NETWORK_socket_socket (PF_INET6, SOCK_STREAM, 0);
+  s = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
   if (NULL == s)
     {
       if ((errno == ENOBUFS) ||





reply via email to

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