aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-29 08:26:14 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-29 08:26:14 +0000
commitbc5612fd3b21b6780c3a48f8974c63ab7284d8d4 (patch)
treeffa3f10b5b998ca0ba860a06484a2dd439437f71 /src/nse
parent1b9cf338499c5b00f318339289f1827ab52e47b8 (diff)
downloadgnunet-bc5612fd3b21b6780c3a48f8974c63ab7284d8d4.tar.gz
gnunet-bc5612fd3b21b6780c3a48f8974c63ab7284d8d4.zip
option for not having delays
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 6a1e577fe..4fea02c34 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -45,6 +45,8 @@
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_YES
49
48/** 50/**
49 * Send messages on connect. 51 * Send messages on connect.
50 */ 52 */
@@ -396,6 +398,9 @@ get_matching_bits_delay (uint32_t matching_bits)
396static struct GNUNET_TIME_Relative 398static struct GNUNET_TIME_Relative
397get_delay_randomization (uint32_t matching_bits) 399get_delay_randomization (uint32_t matching_bits)
398{ 400{
401#if NODELAYS
402 return GNUNET_TIME_UNIT_ZERO;
403#else
399 struct GNUNET_TIME_Relative ret; 404 struct GNUNET_TIME_Relative ret;
400 405
401 if (matching_bits == 0) 406 if (matching_bits == 0)
@@ -403,6 +408,7 @@ get_delay_randomization (uint32_t matching_bits)
403 ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 408 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))); 409 (uint32_t) (get_matching_bits_delay (matching_bits - 1) / (double) (hop_count_max + 1)));
405 return ret; 410 return ret;
411#endif
406} 412}
407 413
408 414
@@ -447,8 +453,12 @@ get_transmit_delay (int round_offset)
447 { 453 {
448 case -1: 454 case -1:
449 /* previous round is randomized between 0 and 50 ms */ 455 /* previous round is randomized between 0 and 50 ms */
456#if NODELAYS
457 ret = GNUNET_TIME_UNIT_ZERO;
458#else
450 ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 459 ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
451 50); 460 50);
461#endif
452#if DEBUG_NSE 462#if DEBUG_NSE
453 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 463 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
454 "Transmitting previous round behind schedule in %llu ms\n", 464 "Transmitting previous round behind schedule in %llu ms\n",