aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-22 13:06:59 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-22 13:06:59 +0000
commitedf96a3a7167f674cb69ef73b9abda8fec34f910 (patch)
tree7646365ec81f299622c40ad637b4dbbb44b1ee18 /src
parent8da7412420e7bd63fd3d26313fb7f879b0c16b62 (diff)
downloadgnunet-edf96a3a7167f674cb69ef73b9abda8fec34f910.tar.gz
gnunet-edf96a3a7167f674cb69ef73b9abda8fec34f910.zip
connection limits
Diffstat (limited to 'src')
-rw-r--r--src/nse/nse-profiler.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/nse/nse-profiler.c b/src/nse/nse-profiler.c
index a1e15fdcb..2dbb4cfed 100644
--- a/src/nse/nse-profiler.c
+++ b/src/nse/nse-profiler.c
@@ -31,8 +31,6 @@
31 31
32#define VERBOSE GNUNET_NO 32#define VERBOSE GNUNET_NO
33 33
34#define CONNECT_LIMIT GNUNET_YES
35
36struct NSEPeer 34struct NSEPeer
37{ 35{
38 struct NSEPeer *prev; 36 struct NSEPeer *prev;
@@ -94,6 +92,11 @@ static unsigned long long current_round;
94static unsigned long long peers_next_round; 92static unsigned long long peers_next_round;
95 93
96/** 94/**
95 * Maximum number of connections to NSE services.
96 */
97static unsigned long long connection_limit;
98
99/**
97 * Total number of connections in the whole network. 100 * Total number of connections in the whole network.
98 */ 101 */
99static unsigned int total_connections; 102static unsigned int total_connections;
@@ -229,10 +232,8 @@ connect_nse_service (void *cls,
229 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TEST_NSE_MULTIPEER: connecting to nse service of peers\n"); 232 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TEST_NSE_MULTIPEER: connecting to nse service of peers\n");
230 for (i = 0; i < num_peers; i++) 233 for (i = 0; i < num_peers; i++)
231 { 234 {
232#if CONNECT_LIMIT 235 if ((connection_limit > 0) && (i % (num_peers / connection_limit) != 0))
233 if (i % 50 != 0)
234 continue; 236 continue;
235#endif
236 current_peer = GNUNET_malloc(sizeof(struct NSEPeer)); 237 current_peer = GNUNET_malloc(sizeof(struct NSEPeer));
237 current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i); 238 current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i);
238 if (GNUNET_YES == GNUNET_TESTING_daemon_running(GNUNET_TESTING_daemon_get(pg, i))) 239 if (GNUNET_YES == GNUNET_TESTING_daemon_running(GNUNET_TESTING_daemon_get(pg, i)))
@@ -549,6 +550,11 @@ run (void *cls,
549 return; 550 return;
550 } 551 }
551 552
553 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, "nse-profiler", "connection_limit", &connection_limit))
554 {
555 connection_limit = 0;
556 }
557
552 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", "topology_output_file", &topology_file)) 558 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", "topology_output_file", &topology_file))
553 { 559 {
554 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Option nse-profiler:topology_output_file is required!\n"); 560 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Option nse-profiler:topology_output_file is required!\n");