[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13814 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13814 - gnunet/src/dht |
Date: |
Fri, 26 Nov 2010 16:07:34 +0100 |
Author: nevans
Date: 2010-11-26 16:07:34 +0100 (Fri, 26 Nov 2010)
New Revision: 13814
Modified:
gnunet/src/dht/gnunet-service-dht.c
Log:
use remainder from forward_count
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-11-26 14:46:44 UTC (rev 13813)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-11-26 15:07:34 UTC (rev 13814)
@@ -2845,17 +2845,20 @@
}
random_value = 0;
- /* FIXME: we use diameter as the expected number of hops, but with
randomized routing we will likely route to more! */
+ forward_count = 1;
target_value = target_replication / (diameter + ((float)target_replication *
hop_count));
if (target_value > 1)
- return (unsigned int)target_value;
+ {
+ /* Set forward count to floor of target_value */
+ forward_count = (unsigned int)target_value;
+ /* Subtract forward_count (floor) from target_value (yields value
between 0 and 1) */
+ target_value = target_value - forward_count;
+ }
else
random_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG,
(unsigned int)-1);
if (random_value < (target_value * (unsigned int)-1))
- forward_count = 2;
- else
- forward_count = 1;
+ forward_count += 1;
return forward_count;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13814 - gnunet/src/dht,
gnunet <=