From 59aa7fbf7e659fc89edaae7e333e0b9ba4e6313f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 1 Aug 2011 08:18:39 +0000 Subject: [PATCH] cleanup --- src/nse/gnunet-service-nse.c | 26 +++++++++++++++++--------- src/nse/nse.h | 6 +++--- src/nse/test_nse.conf | 6 +++--- src/nse/test_nse_multipeer.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index b0a8a1435..84a4ea9f0 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -45,12 +45,18 @@ #include "gnunet_nse_service.h" #include "nse.h" -#define NODELAYS GNUNET_NO +/** + * Should messages be delayed randomly? This option should be set to + * GNUNET_NO only for experiments, not in production. It should also + * be removed once the initial experiments have been completed. + */ +#define USE_RANDOM_DELAYS GNUNET_YES /** * Should we generate a histogram with the time stamps of when we received * NSE messages to disk? (for performance evaluation only, not useful in - * production) + * production). The associated code should also probably be removed + * once we're done with experiments. */ #define ENABLE_HISTOGRAM GNUNET_NO @@ -84,8 +90,10 @@ static struct GNUNET_TIME_Relative gnunet_nse_interval; */ static struct GNUNET_TIME_Relative proof_find_delay; - #if ENABLE_HISTOGRAM +/** + * Handle for writing when we received messages to disk. + */ static struct GNUNET_BIO_WriteHandle *wh; #endif @@ -393,9 +401,7 @@ get_matching_bits_delay (uint32_t matching_bits) static struct GNUNET_TIME_Relative get_delay_randomization (uint32_t matching_bits) { -#if NODELAYS - return GNUNET_TIME_UNIT_ZERO; -#else +#if USE_RANDOM_DELAYS struct GNUNET_TIME_Relative ret; if (matching_bits == 0) @@ -403,6 +409,8 @@ get_delay_randomization (uint32_t matching_bits) ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) (get_matching_bits_delay (matching_bits - 1) / (double) (hop_count_max + 1))); return ret; +#else + return GNUNET_TIME_UNIT_ZERO; #endif } @@ -448,11 +456,11 @@ get_transmit_delay (int round_offset) { case -1: /* previous round is randomized between 0 and 50 ms */ -#if NODELAYS - ret = GNUNET_TIME_UNIT_ZERO; -#else +#if USE_RANDOM_DELAYS ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 50); +#else + ret = GNUNET_TIME_UNIT_ZERO; #endif #if DEBUG_NSE GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/nse/nse.h b/src/nse/nse.h index 45748b1f3..38cafafa3 100644 --- a/src/nse/nse.h +++ b/src/nse/nse.h @@ -30,11 +30,11 @@ #include "gnunet_common.h" +/** + * Generate debug-level log messages? + */ #define DEBUG_NSE GNUNET_NO -#define VERIFY_CRYPTO GNUNET_NO - - /** * Network size estimate sent from the service * to clients. Contains the current size estimate diff --git a/src/nse/test_nse.conf b/src/nse/test_nse.conf index ab64dffe2..38910d9c2 100644 --- a/src/nse/test_nse.conf +++ b/src/nse/test_nse.conf @@ -9,13 +9,13 @@ BINARY = gnunet-service-nse #BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse #PREFIX = valgrind --leak-check=full --log-file=valgrind_nse.%p AUTOSTART = YES -DEBUG = YES +DEBUG = NO CONFIG = $DEFAULTCONFIG PROOFFILE = $SERVICEHOME/proof.nse # Overriding network settings for faster testing (do NOT use # these values in production just because they are here) WORKDELAY = 1 -INTERVAL = 120000 +INTERVAL = 5000 WORKBITS = 1 HISTOGRAM = $SERVICEHOME/nse-histogram @@ -58,7 +58,7 @@ EXTERNAL_ADDRESS = 127.0.0.1 AUTOSTART = NO [testing] -NUM_PEERS = 100 +NUM_PEERS = 10 WEAKRANDOM = YES TOPOLOGY = NONE CONNECT_TOPOLOGY = SMALL_WORLD_RING diff --git a/src/nse/test_nse_multipeer.c b/src/nse/test_nse_multipeer.c index e15892bce..0f5edeb48 100644 --- a/src/nse/test_nse_multipeer.c +++ b/src/nse/test_nse_multipeer.c @@ -51,7 +51,7 @@ struct NSEPeer *peer_tail; /** * How long do we run the test? */ -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 60) +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) static int ok; -- 2.25.1