gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6503 - GNUnet/src/transports


From: gnunet
Subject: [GNUnet-SVN] r6503 - GNUnet/src/transports
Date: Sun, 2 Mar 2008 00:22:52 -0700 (MST)

Author: grothoff
Date: 2008-03-02 00:22:51 -0700 (Sun, 02 Mar 2008)
New Revision: 6503

Modified:
   GNUnet/src/transports/http.c
   GNUnet/src/transports/udp.c
Log:
alternate

Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c        2008-03-02 07:21:20 UTC (rev 6502)
+++ GNUnet/src/transports/http.c        2008-03-02 07:22:51 UTC (rev 6503)
@@ -1147,6 +1147,13 @@
     {
       GNUNET_hash_to_enc (&coreAPI->myIdentity->hashPubKey, &enc);
       available = ntohs (haddr->availability) & available_protocols;
+      if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6))
+       {
+         if (GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, 2) == 0)
+           available = VERSION_AVAILABLE_IPV4;
+         else
+           available = VERSION_AVAILABLE_IPV6;
+       }
       if ((available & VERSION_AVAILABLE_IPV4) > 0)
         {
           if (NULL == inet_ntop (AF_INET, &haddr->ipv4, buf, IP_BUF_LEN))

Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2008-03-02 07:21:20 UTC (rev 6502)
+++ GNUnet/src/transports/udp.c 2008-03-02 07:22:51 UTC (rev 6503)
@@ -345,7 +345,13 @@
   available = ntohs (haddr->availability) & available_protocols;
   if (available == VERSION_AVAILABLE_NONE)
     return GNUNET_SYSERR;
-
+  if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6))
+    {
+      if (GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, 2) == 0)
+       available = VERSION_AVAILABLE_IPV4;
+      else
+       available = VERSION_AVAILABLE_IPV6;
+    }
   ssize = size + sizeof (UDPMessage);
   mp = GNUNET_malloc (ssize);
   mp->header.size = htons (ssize);





reply via email to

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