[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1102 - GNUnet/src/applications/topology_default
From: |
durner |
Subject: |
[GNUnet-SVN] r1102 - GNUnet/src/applications/topology_default |
Date: |
Mon, 27 Jun 2005 14:15:11 -0700 (PDT) |
Author: durner
Date: 2005-06-27 14:15:09 -0700 (Mon, 27 Jun 2005)
New Revision: 1102
Modified:
GNUnet/src/applications/topology_default/topology.c
Log:
We don't need a strong RNG here. random() reduces the load on slow machines
dramatically.
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-06-27 21:01:13 UTC
(rev 1101)
+++ GNUnet/src/applications/topology_default/topology.c 2005-06-27 21:15:09 UTC
(rev 1102)
@@ -52,16 +52,16 @@
#define LIVE_SCAN_FREQUENCY 500 * cronMILLIS
/**
- * Value > 1 that determines the chance (1:LSE) that the cron job
+ * Value < 1 that determines the chance (1:(1/LSE)) that the cron job
* actually tries to do something for a given slot.
*/
-#define LIVE_SCAN_EFFECTIVENESS 10
+#define LIVE_SCAN_EFFECTIVENESS 0.1
/**
- * Value > 1 that determines the chance (1:LPE) that the cron job
+ * Value < 1 that determines the chance (1:(1/LPE)) that the cron job
* actually tries to ping a peer that is about to time-out.
*/
-#define LIVE_PING_EFFECTIVENESS 100
+#define LIVE_PING_EFFECTIVENESS 0.01
static CoreAPIForApplication * coreAPI;
@@ -259,7 +259,7 @@
if (minint == 0)
minint = 1;
for (i=slotCount-1;i>=0;i--) {
- if (randomi(LIVE_SCAN_EFFECTIVENESS) != 0)
+ if (((double) random() / RAND_MAX) > LIVE_SCAN_EFFECTIVENESS)
continue;
if ( (minint > coreAPI->isSlotUsed(i)) &&
(! testConfigurationString("GNUNETD",
@@ -267,7 +267,7 @@
"YES")) )
scanForHosts(i);
}
- if (randomi(LIVE_PING_EFFECTIVENESS) == 0)
+ if (((double) random() / RAND_MAX) <= LIVE_PING_EFFECTIVENESS)
active = coreAPI->forAllConnectedNodes
(&checkNeedForPing,
NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1102 - GNUnet/src/applications/topology_default,
durner <=