gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r25846 - gnunet/src/util
Date: Mon, 21 Jan 2013 16:50:39 +0100

Author: grothoff
Date: 2013-01-21 16:50:39 +0100 (Mon, 21 Jan 2013)
New Revision: 25846

Modified:
   gnunet/src/util/connection.c
Log:
-undo 25844

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2013-01-21 15:43:13 UTC (rev 25845)
+++ gnunet/src/util/connection.c        2013-01-21 15:50:39 UTC (rev 25846)
@@ -733,68 +733,27 @@
   ap->addrlen = addrlen;
   ap->connection = connection;
 
-  ap->sock = GNUNET_NETWORK_socket_create (ap->addr->sa_family, SOCK_STREAM, 
0);
-  if (NULL == ap->sock)
-  {
-    GNUNET_free (ap);
-    return;                     /* not supported by OS */
-  }
   switch (ap->addr->sa_family)
   {
   case AF_INET:
-    {
-      struct sockaddr_in bnd;
-
-      ((struct sockaddr_in *) ap->addr)->sin_port = htons (connection->port);
-
-      bnd.sin_family = AF_INET;
-      bnd.sin_port = htons (0);
-      bnd.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      bnd.sin_len = sizeof (bnd);
-#endif
-      if (0 == memcmp (&bnd.sin_addr.s_addr,
-                      &((struct sockaddr_in *) ap->addr)->sin_addr.s_addr,
-                      sizeof (bnd.sin_addr.s_addr)))
-      {
-       /* bind source IP to FORCE it to be loopback */
-       (void) GNUNET_NETWORK_socket_bind (ap->sock, 
-                                          (const struct sockaddr *) &bnd,
-                                          sizeof (bnd));
-      }
-    }
+    ((struct sockaddr_in *) ap->addr)->sin_port = htons (connection->port);
     break;
   case AF_INET6:
-    {
-      struct sockaddr_in6 bnd;
-
-      ((struct sockaddr_in6 *) ap->addr)->sin6_port = htons (connection->port);
-    
-      bnd.sin6_family = AF_INET6;
-      bnd.sin6_port = htons (0);
-      bnd.sin6_addr = in6addr_loopback;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      bnd.sin6_len = sizeof (bnd);
-#endif
-      if (0 == memcmp (&bnd.sin6_addr,
-                      &((struct sockaddr_in6 *) ap->addr)->sin6_addr,
-                      sizeof (bnd.sin6_addr)))
-      {
-       /* bind source IP to FORCE it to be loopback */
-       (void) GNUNET_NETWORK_socket_bind (ap->sock, 
-                                          (const struct sockaddr *) &bnd, 
-                                          sizeof (bnd));
-      }
-    }
+    ((struct sockaddr_in6 *) ap->addr)->sin6_port = htons (connection->port);
     break;
   default:
     GNUNET_break (0);
     GNUNET_free (ap);
     return;                     /* not supported by us */
   }
+  ap->sock = GNUNET_NETWORK_socket_create (ap->addr->sa_family, SOCK_STREAM, 
0);
+  if (NULL == ap->sock)
+  {
+    GNUNET_free (ap);
+    return;                     /* not supported by OS */
+  }
   LOG (GNUNET_ERROR_TYPE_INFO, _("Trying to connect to `%s' (%p)\n"),
        GNUNET_a2s (ap->addr, ap->addrlen), connection);
-  
   if ((GNUNET_OK !=
        GNUNET_NETWORK_socket_connect (ap->sock, ap->addr, ap->addrlen)) &&
       (EINPROGRESS != errno))




reply via email to

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