diff options
Diffstat (limited to 'src/nse/gnunet-service-nse.c')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 26 |
1 files changed, 17 insertions, 9 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 @@ | |||
45 | #include "gnunet_nse_service.h" | 45 | #include "gnunet_nse_service.h" |
46 | #include "nse.h" | 46 | #include "nse.h" |
47 | 47 | ||
48 | #define NODELAYS GNUNET_NO | 48 | /** |
49 | * Should messages be delayed randomly? This option should be set to | ||
50 | * GNUNET_NO only for experiments, not in production. It should also | ||
51 | * be removed once the initial experiments have been completed. | ||
52 | */ | ||
53 | #define USE_RANDOM_DELAYS GNUNET_YES | ||
49 | 54 | ||
50 | /** | 55 | /** |
51 | * Should we generate a histogram with the time stamps of when we received | 56 | * Should we generate a histogram with the time stamps of when we received |
52 | * NSE messages to disk? (for performance evaluation only, not useful in | 57 | * NSE messages to disk? (for performance evaluation only, not useful in |
53 | * production) | 58 | * production). The associated code should also probably be removed |
59 | * once we're done with experiments. | ||
54 | */ | 60 | */ |
55 | #define ENABLE_HISTOGRAM GNUNET_NO | 61 | #define ENABLE_HISTOGRAM GNUNET_NO |
56 | 62 | ||
@@ -84,8 +90,10 @@ static struct GNUNET_TIME_Relative gnunet_nse_interval; | |||
84 | */ | 90 | */ |
85 | static struct GNUNET_TIME_Relative proof_find_delay; | 91 | static struct GNUNET_TIME_Relative proof_find_delay; |
86 | 92 | ||
87 | |||
88 | #if ENABLE_HISTOGRAM | 93 | #if ENABLE_HISTOGRAM |
94 | /** | ||
95 | * Handle for writing when we received messages to disk. | ||
96 | */ | ||
89 | static struct GNUNET_BIO_WriteHandle *wh; | 97 | static struct GNUNET_BIO_WriteHandle *wh; |
90 | #endif | 98 | #endif |
91 | 99 | ||
@@ -393,9 +401,7 @@ get_matching_bits_delay (uint32_t matching_bits) | |||
393 | static struct GNUNET_TIME_Relative | 401 | static struct GNUNET_TIME_Relative |
394 | get_delay_randomization (uint32_t matching_bits) | 402 | get_delay_randomization (uint32_t matching_bits) |
395 | { | 403 | { |
396 | #if NODELAYS | 404 | #if USE_RANDOM_DELAYS |
397 | return GNUNET_TIME_UNIT_ZERO; | ||
398 | #else | ||
399 | struct GNUNET_TIME_Relative ret; | 405 | struct GNUNET_TIME_Relative ret; |
400 | 406 | ||
401 | if (matching_bits == 0) | 407 | if (matching_bits == 0) |
@@ -403,6 +409,8 @@ get_delay_randomization (uint32_t matching_bits) | |||
403 | ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 409 | ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
404 | (uint32_t) (get_matching_bits_delay (matching_bits - 1) / (double) (hop_count_max + 1))); | 410 | (uint32_t) (get_matching_bits_delay (matching_bits - 1) / (double) (hop_count_max + 1))); |
405 | return ret; | 411 | return ret; |
412 | #else | ||
413 | return GNUNET_TIME_UNIT_ZERO; | ||
406 | #endif | 414 | #endif |
407 | } | 415 | } |
408 | 416 | ||
@@ -448,11 +456,11 @@ get_transmit_delay (int round_offset) | |||
448 | { | 456 | { |
449 | case -1: | 457 | case -1: |
450 | /* previous round is randomized between 0 and 50 ms */ | 458 | /* previous round is randomized between 0 and 50 ms */ |
451 | #if NODELAYS | 459 | #if USE_RANDOM_DELAYS |
452 | ret = GNUNET_TIME_UNIT_ZERO; | ||
453 | #else | ||
454 | ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 460 | ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
455 | 50); | 461 | 50); |
462 | #else | ||
463 | ret = GNUNET_TIME_UNIT_ZERO; | ||
456 | #endif | 464 | #endif |
457 | #if DEBUG_NSE | 465 | #if DEBUG_NSE |
458 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 466 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |