aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-01 08:18:39 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-01 08:18:39 +0000
commit59aa7fbf7e659fc89edaae7e333e0b9ba4e6313f (patch)
tree097b23bd1ec3a28f4b5b1efed496db365481a3e4 /src/nse
parent1f00142aa86a7dedc302f8dea29dc5e0609a1b52 (diff)
downloadgnunet-59aa7fbf7e659fc89edaae7e333e0b9ba4e6313f.tar.gz
gnunet-59aa7fbf7e659fc89edaae7e333e0b9ba4e6313f.zip
cleanup
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c26
-rw-r--r--src/nse/nse.h6
-rw-r--r--src/nse/test_nse.conf6
-rw-r--r--src/nse/test_nse_multipeer.c2
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 @@
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 */
85static struct GNUNET_TIME_Relative proof_find_delay; 91static 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 */
89static struct GNUNET_BIO_WriteHandle *wh; 97static struct GNUNET_BIO_WriteHandle *wh;
90#endif 98#endif
91 99
@@ -393,9 +401,7 @@ get_matching_bits_delay (uint32_t matching_bits)
393static struct GNUNET_TIME_Relative 401static struct GNUNET_TIME_Relative
394get_delay_randomization (uint32_t matching_bits) 402get_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,
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 @@
30 30
31#include "gnunet_common.h" 31#include "gnunet_common.h"
32 32
33/**
34 * Generate debug-level log messages?
35 */
33#define DEBUG_NSE GNUNET_NO 36#define DEBUG_NSE GNUNET_NO
34 37
35#define VERIFY_CRYPTO GNUNET_NO
36
37
38/** 38/**
39 * Network size estimate sent from the service 39 * Network size estimate sent from the service
40 * to clients. Contains the current size estimate 40 * 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
9#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse 9#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse
10#PREFIX = valgrind --leak-check=full --log-file=valgrind_nse.%p 10#PREFIX = valgrind --leak-check=full --log-file=valgrind_nse.%p
11AUTOSTART = YES 11AUTOSTART = YES
12DEBUG = YES 12DEBUG = NO
13CONFIG = $DEFAULTCONFIG 13CONFIG = $DEFAULTCONFIG
14PROOFFILE = $SERVICEHOME/proof.nse 14PROOFFILE = $SERVICEHOME/proof.nse
15# Overriding network settings for faster testing (do NOT use 15# Overriding network settings for faster testing (do NOT use
16# these values in production just because they are here) 16# these values in production just because they are here)
17WORKDELAY = 1 17WORKDELAY = 1
18INTERVAL = 120000 18INTERVAL = 5000
19WORKBITS = 1 19WORKBITS = 1
20 20
21HISTOGRAM = $SERVICEHOME/nse-histogram 21HISTOGRAM = $SERVICEHOME/nse-histogram
@@ -58,7 +58,7 @@ EXTERNAL_ADDRESS = 127.0.0.1
58AUTOSTART = NO 58AUTOSTART = NO
59 59
60[testing] 60[testing]
61NUM_PEERS = 100 61NUM_PEERS = 10
62WEAKRANDOM = YES 62WEAKRANDOM = YES
63TOPOLOGY = NONE 63TOPOLOGY = NONE
64CONNECT_TOPOLOGY = SMALL_WORLD_RING 64CONNECT_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;
51/** 51/**
52 * How long do we run the test? 52 * How long do we run the test?
53 */ 53 */
54#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 60) 54#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
55 55
56static int ok; 56static int ok;
57 57