gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26358 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r26358 - gnunet/src/dht
Date: Fri, 8 Mar 2013 14:27:39 +0100

Author: grothoff
Date: 2013-03-08 14:27:39 +0100 (Fri, 08 Mar 2013)
New Revision: 26358

Modified:
   gnunet/src/dht/gnunet-service-dht_neighbours.c
Log:
-make DHt routing more sane

Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c      2013-03-08 13:00:59 UTC 
(rev 26357)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c      2013-03-08 13:27:39 UTC 
(rev 26358)
@@ -857,12 +857,12 @@
   uint32_t forward_count;
   float target_value;
 
-  if (hop_count > GDS_NSE_get () * 6.0)
+  if (hop_count > GDS_NSE_get () * 4.0)
   {
     /* forcefully terminate */
     return 0;
   }
-  if (hop_count > GDS_NSE_get () * 4.0)
+  if (hop_count > GDS_NSE_get () * 2.0)
   {
     /* Once we have reached our ideal number of hops, only forward to 1 peer */
     return 1;
@@ -1053,6 +1053,12 @@
                                     gettext_noop
                                     ("# Peers excluded from routing due to 
Bloomfilter"),
                                     1, GNUNET_NO);
+          dist = get_distance (key, &pos->id.hashPubKey);
+          if (dist < smallest_distance)
+          {
+            chosen = NULL;
+            smallest_distance = dist;
+          }
         }
         count++;
         pos = pos->next;
@@ -1091,7 +1097,7 @@
       pos = pos->next;
     }
   }
-  if (count == 0)               /* No peers to select from! */
+  if (0 == count)               /* No peers to select from! */
   {
     GNUNET_STATISTICS_update (GDS_stats,
                               gettext_noop ("# Peer selection failed"), 1,
@@ -1146,7 +1152,7 @@
 
   GNUNET_assert (NULL != bloom);
   ret = get_forward_count (hop_count, target_replication);  
-  if (ret == 0)
+  if (0 == ret)
   {
     *targets = NULL;
     return 0;
@@ -1155,7 +1161,7 @@
   for (off = 0; off < ret; off++)
   {
     nxt = select_peer (key, bloom, hop_count);
-    if (nxt == NULL)
+    if (NULL == nxt)
       break;
     rtargets[off] = nxt;
     GNUNET_break (GNUNET_NO ==




reply via email to

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