gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5936 - in GNUnet/src/applications: dht/module topology_def


From: gnunet
Subject: [GNUnet-SVN] r5936 - in GNUnet/src/applications: dht/module topology_default
Date: Sun, 16 Dec 2007 15:15:23 -0700 (MST)

Author: grothoff
Date: 2007-12-16 15:15:23 -0700 (Sun, 16 Dec 2007)
New Revision: 5936

Modified:
   GNUnet/src/applications/dht/module/routing.c
   GNUnet/src/applications/topology_default/topology.c
Log:
fix

Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c        2007-12-16 22:09:50 UTC 
(rev 5935)
+++ GNUnet/src/applications/dht/module/routing.c        2007-12-16 22:15:23 UTC 
(rev 5936)
@@ -574,6 +574,7 @@
   unsigned int target_value;
   int store;
   int i;
+  unsigned int j;
 #if DEBUG_ROUTING
   GNUNET_EncName enc;
 #endif
@@ -599,11 +600,11 @@
   memcpy (aput, put, ntohs (msg->size));
   aput->hop_count = htons (hop_count + 1);
 
-
+  j = 0;
   for (i = 0; i < target_value; i++)
     {
       if (GNUNET_OK !=
-          GNUNET_DHT_select_peer (&next[i], &put->key, &next[0], i))
+          GNUNET_DHT_select_peer (&next[j], &put->key, &next[0], j))
         {
 #if DEBUG_ROUTING
           GNUNET_GE_LOG (coreAPI->ectx,
@@ -614,18 +615,22 @@
 #endif
           store = 1;
         }
-      if (1 == GNUNET_hash_xorcmp (&next[i].hashPubKey,
+      else
+       {
+         j++;
+       }
+      if (1 == GNUNET_hash_xorcmp (&next[j].hashPubKey,
                                    &coreAPI->myIdentity->hashPubKey,
                                    &put->key))
         store = 1;              /* we're closer than the selected target */
 #if DEBUG_ROUTING
-      GNUNET_hash_to_enc (&next[i].hashPubKey, &enc);
+      GNUNET_hash_to_enc (&next[j].hashPubKey, &enc);
       GNUNET_GE_LOG (coreAPI->ectx,
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
                      GNUNET_GE_DEVELOPER,
                      "Forwarding DHT PUT request to peer `%s'.\n", &enc);
 #endif
-      coreAPI->unicast (&next[i], &aput->header, DHT_PRIORITY, DHT_DELAY);
+      coreAPI->unicast (&next[j], &aput->header, DHT_PRIORITY, DHT_DELAY);
     }
   GNUNET_free (aput);
   if (store != 0)

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-12-16 22:09:50 UTC 
(rev 5935)
+++ GNUnet/src/applications/topology_default/topology.c 2007-12-16 22:15:23 UTC 
(rev 5936)
@@ -545,7 +545,7 @@
                          GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
                          _("Failed to read friends list from `%s'\n"), fn);
           GNUNET_free (fn);
-          GNUNET_free (data);
+          GNUNET_free (data);    
           return GNUNET_SYSERR;
         }
       GNUNET_free (fn);
@@ -599,6 +599,7 @@
                          _
                          ("More friendly connections required than target 
total number of connections.\n"));
         }
+      GNUNET_free (data);        
     }
   return 0;
 }





reply via email to

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