[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14356 - in gnunet/src: dht fs include testing topology
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14356 - in gnunet/src: dht fs include testing topology |
Date: |
Sat, 5 Feb 2011 15:19:43 +0100 |
Author: nevans
Date: 2011-02-05 15:19:42 +0100 (Sat, 05 Feb 2011)
New Revision: 14356
Modified:
gnunet/src/dht/gnunet-dht-driver.c
gnunet/src/fs/fs_test_lib.c
gnunet/src/include/gnunet_testing_lib.h
gnunet/src/testing/Makefile.am
gnunet/src/testing/test_testing_group.c
gnunet/src/testing/test_testing_group_remote.c
gnunet/src/testing/test_testing_large_topology.c
gnunet/src/testing/test_testing_topology.c
gnunet/src/testing/test_testing_topology_blacklist.c
gnunet/src/testing/test_testing_topology_churn.c
gnunet/src/testing/testing_group.c
gnunet/src/topology/test_gnunet_daemon_topology.c
Log:
configurable connect options
Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c 2011-02-05 13:48:42 UTC (rev 14355)
+++ gnunet/src/dht/gnunet-dht-driver.c 2011-02-05 14:19:42 UTC (rev 14356)
@@ -67,7 +67,7 @@
#define FIND_PEER_THRESHOLD 1
/* If more than this many peers are added, slow down sending */
-#define MAX_FIND_PEER_CUTOFF 4000
+#define MAX_FIND_PEER_CUTOFF 2000
/* If less than this many peers are added, speed up sending */
#define MIN_FIND_PEER_CUTOFF 500
@@ -77,7 +77,7 @@
#define DEFAULT_MAX_OUTSTANDING_PUTS 10
-#define DEFAULT_MAX_OUTSTANDING_FIND_PEERS 196
+#define DEFAULT_MAX_OUTSTANDING_FIND_PEERS 128
#define DEFAULT_FIND_PEER_OFFSET GNUNET_TIME_relative_divide
(DEFAULT_FIND_PEER_DELAY, DEFAULT_MAX_OUTSTANDING_FIND_PEERS)
@@ -372,6 +372,16 @@
/* Globals */
/**
+ * How long to try to connect two peers.
+ */
+struct GNUNET_TIME_Relative connect_timeout;
+
+/**
+ * How many times to re-attempt connecting two peers.
+ */
+static unsigned long long connect_attempts;
+
+/**
* Timeout to let all GET requests happen.
*/
static struct GNUNET_TIME_Relative all_get_timeout;
@@ -436,6 +446,11 @@
static unsigned long long test_data_size = DEFAULT_TEST_DATA_SIZE;
/**
+ * Maximum number of concurrent connections to peers.
+ */
+static unsigned long long max_outstanding_connections;
+
+/**
* Maximum number of concurrent PUT requests.
*/
static unsigned long long max_outstanding_puts = DEFAULT_MAX_OUTSTANDING_PUTS;
@@ -2533,7 +2548,7 @@
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Conns/sec in last %d seconds: %f,
Conns/sec for entire duration: %f\n", CONN_UPDATE_DURATION,
(float)new_connections / duration, (float)total_connections / total_duration);
connect_last_time = GNUNET_TIME_absolute_get();
previous_connections = total_connections;
-
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "have %u total_connections\n",
total_connections);
}
if (emsg == NULL)
{
@@ -2631,7 +2646,11 @@
if ((pg != NULL) && (peers_left == 0))
{
connect_start_time = GNUNET_TIME_absolute_get();
- expected_connections = GNUNET_TESTING_connect_topology (pg,
connect_topology, connect_topology_option, connect_topology_option_modifier,
NULL, NULL);
+ expected_connections = GNUNET_TESTING_connect_topology(pg,
+
connect_topology, connect_topology_option,
+
connect_topology_option_modifier,
+
connect_timeout, connect_attempts,
+ NULL, NULL);
peer_connect_meter = create_meter(expected_connections, "Peer
connection ", GNUNET_YES);
fprintf(stderr, "Have %d expected connections\n",
expected_connections);
@@ -2767,6 +2786,34 @@
}
GNUNET_assert(num_peers > 0 && num_peers < ULONG_MAX);
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+ &temp_config_number))
+ connect_timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
temp_config_number);
+ else
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_timeout");
+ return;
+ }
+
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
"connect_attempts",
+ &connect_attempts))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_attempts");
+ return;
+ }
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
"max_outstanding_connections",
+ &max_outstanding_connections))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "max_outstanding_connections");
+ return;
+ }
+
/**
* Get DHT specific testing options.
*/
@@ -3314,6 +3361,7 @@
get_meter = create_meter(num_gets, "Gets completed ", GNUNET_YES);
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ max_outstanding_connections,
GNUNET_TIME_relative_multiply(seconds_per_peer_start, num_peers),
&hostkey_callback, NULL,
&peers_started_callback, NULL,
Modified: gnunet/src/fs/fs_test_lib.c
===================================================================
--- gnunet/src/fs/fs_test_lib.c 2011-02-05 13:48:42 UTC (rev 14355)
+++ gnunet/src/fs/fs_test_lib.c 2011-02-05 14:19:42 UTC (rev 14356)
@@ -394,6 +394,7 @@
daemons[i] = GNUNET_malloc (sizeof (struct GNUNET_FS_TestDaemon));
sctx->group = GNUNET_TESTING_daemons_start (sctx->cfg,
total,
+ total, /* Outstanding connections
*/
timeout,
NULL,
NULL,
Modified: gnunet/src/include/gnunet_testing_lib.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib.h 2011-02-05 13:48:42 UTC (rev
14355)
+++ gnunet/src/include/gnunet_testing_lib.h 2011-02-05 14:19:42 UTC (rev
14356)
@@ -559,13 +559,15 @@
/**
- * Start count gnunetd processes with the same set of transports and
+ * Start count gnunet instances with the same set of transports and
* applications. The port numbers (any option called "PORT") will be
* adjusted to ensure that no two peers running on the same system
* have the same port(s) in their respective configurations.
*
* @param cfg configuration template to use
* @param total number of daemons to start
+ * @param max_concurrent_connections for testing, how many peers can
+ * we connect to simultaneously
* @param timeout total time allowed for peers to start
* @param hostkey_callback function to call on each peers hostkey generation
* if NULL, peers will be started by this call, if non-null,
@@ -576,16 +578,18 @@
* @param cb_cls closure for cb
* @param connect_callback function to call each time two hosts are connected
* @param connect_callback_cls closure for connect_callback
- * @param hostnames linked list of hosts to use to start peers on (NULL to run
on localhost only)
+ * @param hostnames linked list of host structs to use to start peers on
+ * (NULL to run on localhost only)
*
* @return NULL on error, otherwise handle to control peer group
*/
struct GNUNET_TESTING_PeerGroup *
GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int total,
+ unsigned int max_concurrent_connections,
struct GNUNET_TIME_Relative timeout,
- GNUNET_TESTING_NotifyHostkeyCreated
hostkey_callback,
- void *hostkey_cls,
+ GNUNET_TESTING_NotifyHostkeyCreated
+ hostkey_callback, void *hostkey_cls,
GNUNET_TESTING_NotifyDaemonRunning cb,
void *cb_cls,
GNUNET_TESTING_NotifyConnection
@@ -894,20 +898,24 @@
* @param topology which topology to connect the peers in
* @param options options for connecting the topology
* @param option_modifier modifier for options that take a parameter
+ * @param connect_timeout how long to wait before giving up on connecting
+ * two peers
+ * @param connect_attempts how many times to attempt to connect two peers
+ * over the connect_timeout duration
* @param notify_callback notification to be called once all connections
completed
* @param notify_cls closure for notification callback
*
- * @return the number of connections that will be attempted (multiple of two,
- * each bidirectional connection counts twice!), GNUNET_SYSERR on error
- *
+ * @return the number of connections that will be attempted, GNUNET_SYSERR on
error
*/
int
GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
enum GNUNET_TESTING_Topology topology,
enum GNUNET_TESTING_TopologyOption options,
double option_modifier,
- GNUNET_TESTING_NotifyCompletion
notify_callback,
- void *notify_cls);
+ struct GNUNET_TIME_Relative connect_timeout,
+ unsigned int connect_attempts,
+ GNUNET_TESTING_NotifyCompletion
+ notify_callback, void *notify_cls);
/**
* Start or stop an individual peer from the given group.
Modified: gnunet/src/testing/Makefile.am
===================================================================
--- gnunet/src/testing/Makefile.am 2011-02-05 13:48:42 UTC (rev 14355)
+++ gnunet/src/testing/Makefile.am 2011-02-05 14:19:42 UTC (rev 14356)
@@ -20,6 +20,8 @@
$(top_builddir)/src/transport/libgnunettransport.la \
-lm \
$(top_builddir)/src/util/libgnunetutil.la
+
+noinst_PROGRAMS = ${check_PROGRAMS}
check_PROGRAMS = \
test_testing \
@@ -27,6 +29,8 @@
test_testing_reconnect \
test_testing_group \
test_testing_topology_stability \
+ test_testing_large_topology_clique \
+ test_testing_topology_from_file \
test_testing_topology_clique \
test_testing_topology_clique_random \
test_testing_topology_clique_minimum \
@@ -42,30 +46,35 @@
test_testing_topology_erdos_renyi \
test_testing_topology_internat \
test_testing_topology_none \
- test_testing_topology_scale_free
+ test_testing_topology_scale_free \
+ test_testing_topology_connect_only \
+ test_testing_topology_2d_torus_plus
+# test_testing_topology_stability
if !DISABLE_TEST_RUN
TESTS = \
test_testing \
test_testing_connect \
test_testing_reconnect \
test_testing_group \
- test_testing_topology_clique
-# test_testing_topology_stability \
-# test_testing_topology_clique_random \
-# test_testing_topology_clique_minimum \
-# test_testing_topology_clique_dfs \
-# test_testing_topology_churn \
-# test_testing_topology_line
-# test_testing_topology_blacklist \
-# test_testing_group_remote \
-# test_testing_topology_ring \
-# test_testing_topology_2d_torus \
-# test_testing_topology_small_world_ring \
-# test_testing_topology_small_world_torus \
-# test_testing_topology_erdos_renyi \
-# test_testing_topology_internat \
-# test_testing_topology_scale_free
+ test_testing_topology_clique \
+ test_testing_topology_from_file \
+ test_testing_topology_clique_random \
+ test_testing_topology_clique_minimum \
+ test_testing_topology_clique_dfs \
+ test_testing_topology_churn \
+ test_testing_topology_line \
+ test_testing_topology_blacklist \
+ test_testing_group_remote \
+ test_testing_topology_ring \
+ test_testing_topology_2d_torus \
+ test_testing_topology_small_world_ring \
+ test_testing_topology_small_world_torus \
+ test_testing_topology_erdos_renyi \
+ test_testing_topology_internat \
+ test_testing_topology_scale_free \
+ test_testing_topology_connect_only \
+ test_testing_topology_2d_torus_plus
endif
test_testing_SOURCES = \
@@ -80,42 +89,54 @@
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-test_testing_reconnect_SOURCES = \
- test_testing_reconnect.c
-test_testing_reconnect_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
test_testing_group_SOURCES = \
test_testing_group.c
test_testing_group_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_clique_SOURCES = \
test_testing_topology.c
test_testing_topology_clique_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
+test_testing_topology_connect_only_SOURCES = \
+ test_testing_topology.c
+test_testing_topology_connect_only_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_testing_topology_from_file_SOURCES = \
+ test_testing_topology.c
+test_testing_topology_from_file_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_testing_large_topology_clique_SOURCES = \
+ test_testing_large_topology.c
+test_testing_large_topology_clique_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
test_testing_topology_stability_SOURCES = \
test_testing_topology.c
test_testing_topology_stability_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_blacklist_SOURCES = \
test_testing_topology_blacklist.c
test_testing_topology_blacklist_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_churn_SOURCES = \
test_testing_topology_churn.c
test_testing_topology_churn_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_clique_random_SOURCES = \
test_testing_topology.c
test_testing_topology_clique_random_LDADD = \
@@ -127,7 +148,7 @@
test_testing_topology_clique_minimum_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_clique_dfs_SOURCES = \
test_testing_topology.c
test_testing_topology_clique_dfs_LDADD = \
@@ -139,8 +160,13 @@
test_testing_topology_line_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
+
+test_testing_reconnect_SOURCES = \
+ test_testing_reconnect.c
+test_testing_reconnect_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
-
test_testing_group_remote_SOURCES = \
test_testing_group_remote.c
test_testing_group_remote_LDADD = \
@@ -152,25 +178,31 @@
test_testing_topology_ring_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_2d_torus_SOURCES = \
test_testing_topology.c
test_testing_topology_2d_torus_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
+test_testing_topology_2d_torus_plus_SOURCES = \
+ test_testing_topology.c
+test_testing_topology_2d_torus_plus_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
test_testing_topology_small_world_ring_SOURCES = \
test_testing_topology.c
test_testing_topology_small_world_ring_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_small_world_torus_SOURCES = \
test_testing_topology.c
test_testing_topology_small_world_torus_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_internat_SOURCES = \
test_testing_topology.c
test_testing_topology_internat_LDADD = \
@@ -182,7 +214,7 @@
test_testing_topology_erdos_renyi_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
+
test_testing_topology_scale_free_SOURCES = \
test_testing_topology.c
test_testing_topology_scale_free_LDADD = \
@@ -194,8 +226,8 @@
test_testing_topology_none_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
-
-
+
+
EXTRA_DIST = \
test_testing_data.conf \
test_testing_connect_peer1.conf \
@@ -214,4 +246,4 @@
test_testing_data_topology_blacklist.conf \
test_testing_data_topology_churn.conf \
test_testing_data_topology_none.conf
-
+
Modified: gnunet/src/testing/test_testing_group.c
===================================================================
--- gnunet/src/testing/test_testing_group.c 2011-02-05 13:48:42 UTC (rev
14355)
+++ gnunet/src/testing/test_testing_group.c 2011-02-05 14:19:42 UTC (rev
14356)
@@ -117,6 +117,7 @@
peers_left = NUM_PEERS;
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ NUM_PEERS,
TIMEOUT,
NULL, NULL,
&my_cb, NULL, NULL, NULL, NULL);
Modified: gnunet/src/testing/test_testing_group_remote.c
===================================================================
--- gnunet/src/testing/test_testing_group_remote.c 2011-02-05 13:48:42 UTC
(rev 14355)
+++ gnunet/src/testing/test_testing_group_remote.c 2011-02-05 14:19:42 UTC
(rev 14356)
@@ -203,6 +203,7 @@
peers_left = num_peers;
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ peers_left,
TIMEOUT,
NULL,
NULL, &my_cb, NULL, NULL, NULL, hosts);
Modified: gnunet/src/testing/test_testing_large_topology.c
===================================================================
--- gnunet/src/testing/test_testing_large_topology.c 2011-02-05 13:48:42 UTC
(rev 14355)
+++ gnunet/src/testing/test_testing_large_topology.c 2011-02-05 14:19:42 UTC
(rev 14356)
@@ -40,6 +40,10 @@
static int ok;
+struct GNUNET_TIME_Relative connect_timeout;
+
+static unsigned long long connect_attempts;
+
static unsigned long long num_peers;
static unsigned int topology_connections;
@@ -775,6 +779,8 @@
GNUNET_TESTING_connect_topology (pg, connection_topology,
connect_topology_option,
connect_topology_option_modifier,
+ connect_timeout,
+ connect_attempts,
&topology_creation_finished, NULL);
#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1076,6 +1082,26 @@
&num_peers))
num_peers = DEFAULT_NUM_PEERS;
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+ &temp_settle))
+ connect_timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+ else
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_timeout");
+ return;
+ }
+
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
"connect_attempts",
+ &connect_attempts))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_attempts");
+ return;
+ }
+
main_cfg = cfg;
peers_left = num_peers;
@@ -1104,6 +1130,7 @@
GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ peers_left / 2,
timeout,
&hostkey_callback, NULL,
&peers_started_callback, NULL,
Modified: gnunet/src/testing/test_testing_topology.c
===================================================================
--- gnunet/src/testing/test_testing_topology.c 2011-02-05 13:48:42 UTC (rev
14355)
+++ gnunet/src/testing/test_testing_topology.c 2011-02-05 14:19:42 UTC (rev
14356)
@@ -52,6 +52,10 @@
static unsigned long long num_peers;
+struct GNUNET_TIME_Relative connect_timeout;
+
+static unsigned long long connect_attempts;
+
static unsigned int topology_connections;
static unsigned int total_connections;
@@ -814,6 +818,8 @@
GNUNET_TESTING_connect_topology (pg, connection_topology,
connect_topology_option,
connect_topology_option_modifier,
+ connect_timeout,
+ connect_attempts,
&topology_creation_finished, NULL);
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1112,6 +1118,26 @@
settle_time =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+ &temp_settle))
+ connect_timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+ else
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_timeout");
+ return;
+ }
+
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
"connect_attempts",
+ &connect_attempts))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_attempts");
+ return;
+ }
+
if (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
&num_peers))
@@ -1136,6 +1162,7 @@
GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ peers_left / 2,
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
SECONDS_PER_PEER_START * num_peers),
Modified: gnunet/src/testing/test_testing_topology_blacklist.c
===================================================================
--- gnunet/src/testing/test_testing_topology_blacklist.c 2011-02-05
13:48:42 UTC (rev 14355)
+++ gnunet/src/testing/test_testing_topology_blacklist.c 2011-02-05
14:19:42 UTC (rev 14356)
@@ -43,6 +43,10 @@
static int ok;
+struct GNUNET_TIME_Relative connect_timeout;
+
+static unsigned long long connect_attempts;
+
static unsigned long long num_peers;
static unsigned int total_connections;
@@ -256,6 +260,8 @@
GNUNET_TESTING_connect_topology (pg, connection_topology,
connect_topology_option,
connect_topology_option_modifier,
+ connect_timeout,
+ connect_attempts,
NULL, NULL);
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -393,6 +399,7 @@
unsigned long long connect_topology_num;
unsigned long long blacklist_topology_num;
unsigned long long connect_topology_option_num;
+ unsigned long long temp_connect;
char *connect_topology_option_modifier_string;
ok = 1;
@@ -487,6 +494,26 @@
&num_peers))
num_peers = DEFAULT_NUM_PEERS;
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+ &temp_connect))
+ connect_timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_connect);
+ else
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_timeout");
+ return;
+ }
+
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
"connect_attempts",
+ &connect_attempts))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
"testing", "connect_attempts");
+ return;
+ }
+
main_cfg = cfg;
GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
@@ -508,7 +535,8 @@
"didn't start all daemons in
reasonable amount of time!!!");
pg = GNUNET_TESTING_daemons_start (cfg,
- peers_left, TIMEOUT, &hostkey_callback,
+ peers_left, peers_left,
+ TIMEOUT, &hostkey_callback,
NULL, &peers_started_callback, NULL,
&topology_callback, NULL, NULL);
Modified: gnunet/src/testing/test_testing_topology_churn.c
===================================================================
--- gnunet/src/testing/test_testing_topology_churn.c 2011-02-05 13:48:42 UTC
(rev 14355)
+++ gnunet/src/testing/test_testing_topology_churn.c 2011-02-05 14:19:42 UTC
(rev 14356)
@@ -280,6 +280,7 @@
"didn't start all daemons in
reasonable amount of time!!!");
pg = GNUNET_TESTING_daemons_start (cfg,
+ peers_left,
peers_left, TIMEOUT, NULL, NULL,
&peers_started_callback, NULL, NULL,
NULL, NULL);
Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c 2011-02-05 13:48:42 UTC (rev 14355)
+++ gnunet/src/testing/testing_group.c 2011-02-05 14:19:42 UTC (rev 14356)
@@ -53,21 +53,11 @@
*/
#define HIGH_PORT 56000
-#define MAX_OUTSTANDING_CONNECTIONS 200
-
/* Maximum time to delay connect attempt */
#define MAX_CONNECT_DELAY 300
#define MAX_CONCURRENT_HOSTKEYS 500
-#define MAX_CONCURRENT_STARTING 200
-
-#define MAX_CONCURRENT_SHUTDOWN 200
-
-#define CONNECT_TIMEOUT GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 60)
-
-#define CONNECT_ATTEMPTS 12
-
/**
* Which list of peers do we need to modify?
*/
@@ -106,6 +96,11 @@
struct ChurnContext
{
/**
+ * The peergroup we are dealing with.
+ */
+ struct GNUNET_TESTING_PeerGroup *pg;
+
+ /**
* Callback used to notify of churning finished
*/
GNUNET_TESTING_NotifyCompletion cb;
@@ -168,6 +163,7 @@
struct ShutdownContext
{
+ struct GNUNET_TESTING_PeerGroup *pg;
/**
* Total peers to wait for
*/
@@ -349,6 +345,11 @@
struct ChurnRestartContext
{
/**
+ * PeerGroup that we are working with.
+ */
+ struct GNUNET_TESTING_PeerGroup *pg;
+
+ /**
* Number of restarts currently in flight.
*/
unsigned int outstanding;
@@ -494,6 +495,11 @@
struct TopologyIterateContext
{
/**
+ * The peergroup we are working with.
+ */
+ struct GNUNET_TESTING_PeerGroup *pg;
+
+ /**
* Callback for notifying of two connected peers.
*/
GNUNET_TESTING_NotifyTopology topology_cb;
@@ -522,6 +528,11 @@
struct StatsIterateContext
{
/**
+ * The peergroup that we are dealing with.
+ */
+ struct GNUNET_TESTING_PeerGroup *pg;
+
+ /**
* Continuation to call once all stats information has been retrieved.
*/
GNUNET_STATISTICS_Callback cont;
@@ -639,6 +650,18 @@
unsigned int started;
/**
+ * Number of possible connections to peers
+ * at a time.
+ */
+ unsigned int max_outstanding_connections;
+
+ /**
+ * Number of connects we are waiting on, allows us to rate limit
+ * connect attempts.
+ */
+ unsigned int outstanding_connects;
+
+ /**
* Hostkeys loaded from a file.
*/
char *hostkey_data;
@@ -701,6 +724,16 @@
struct ConnectTopologyContext *ct_ctx;
/**
+ * How long to try this connection before timing out.
+ */
+ struct GNUNET_TIME_Relative connect_timeout;
+
+ /**
+ * How many times to retry connecting the two peers.
+ */
+ unsigned int connect_attempts;
+
+ /**
* Whether this connection has been accounted for in the schedule_connect
call.
*/
int counted;
@@ -837,12 +870,6 @@
#endif
/**
- * Number of connects we are waiting on, allows us to rate limit
- * connect attempts.
- */
-static int outstanding_connects;
-
-/**
* Get a topology from a string input.
*
* @param topology where to write the retrieved topology
@@ -2806,7 +2833,7 @@
{
struct ConnectTopologyContext *ct_ctx = cls;
struct GNUNET_TESTING_PeerGroup *pg = ct_ctx->pg;
- outstanding_connects--;
+ pg->outstanding_connects--;
ct_ctx->remaining_connections--;
if (ct_ctx->remaining_connections == 0)
{
@@ -2833,11 +2860,12 @@
schedule_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct ConnectContext *connect_context = cls;
+ struct GNUNET_TESTING_PeerGroup *pg = connect_context->ct_ctx->pg;
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
- if (outstanding_connects > MAX_OUTSTANDING_CONNECTIONS)
+ if (pg->outstanding_connects > pg->max_outstanding_connections)
{
#if VERBOSE_TESTING > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2855,11 +2883,11 @@
_("Creating connection, outstanding_connections is %d\n"),
outstanding_connects);
#endif
- outstanding_connects++;
+ pg->outstanding_connects++;
GNUNET_TESTING_daemons_connect (connect_context->first,
connect_context->second,
- CONNECT_TIMEOUT,
- CONNECT_ATTEMPTS,
+ connect_context->connect_timeout,
+ connect_context->connect_attempts,
&internal_connect_notify,
connect_context->ct_ctx);
GNUNET_free (connect_context);
@@ -2970,6 +2998,8 @@
* of each peer in the peer group
*
* @param pg the peer group we are dealing with
+ * @param connect_timeout how long try connecting two peers
+ * @param connect_attempts how many times (max) to attempt
* @param notify_callback callback to notify when finished
* @param notify_cls closure for notify callback
*
@@ -2977,6 +3007,8 @@
*/
static int
connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
+ struct GNUNET_TIME_Relative connect_timeout,
+ unsigned int connect_attempts,
GNUNET_TESTING_NotifyCompletion notify_callback,
void *notify_cls)
{
@@ -3030,6 +3062,8 @@
connect_context->first = pg->peers[pg_iter].daemon;
connect_context->second = pg->peers[connection_iter->index].daemon;
connect_context->ct_ctx = ct_ctx;
+ connect_context->connect_timeout = connect_timeout;
+ connect_context->connect_attempts = connect_attempts;
GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context);
connection_iter = connection_iter->next;
total++;
@@ -4010,7 +4044,7 @@
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
- if (topology_context->connected > MAX_OUTSTANDING_CONNECTIONS)
+ if (topology_context->connected >
topology_context->pg->max_outstanding_connections)
{
#if VERBOSE_TESTING > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4058,6 +4092,7 @@
topology_context = GNUNET_malloc (sizeof (struct TopologyIterateContext));
topology_context->topology_cb = cb;
topology_context->cls = cls;
+ topology_context->pg = pg;
total_count = 0;
for (i = 0; i < pg->total; i++)
{
@@ -4152,7 +4187,7 @@
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
- if (stats_context->connected > MAX_OUTSTANDING_CONNECTIONS)
+ if (stats_context->connected >
stats_context->pg->max_outstanding_connections)
{
#if VERBOSE_TESTING > 2
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4290,6 +4325,7 @@
stats_context->cont = cont;
stats_context->proc = proc;
stats_context->cls = cls;
+ stats_context->pg = pg;
total_count = 0;
for (i = 0; i < pg->total; i++)
@@ -4338,6 +4374,10 @@
* @param topology which topology to connect the peers in
* @param options options for connecting the topology
* @param option_modifier modifier for options that take a parameter
+ * @param connect_timeout how long to wait before giving up on connecting
+ * two peers
+ * @param connect_attempts how many times to attempt to connect two peers
+ * over the connect_timeout duration
* @param notify_callback notification to be called once all connections
completed
* @param notify_cls closure for notification callback
*
@@ -4348,6 +4388,8 @@
enum GNUNET_TESTING_Topology topology,
enum GNUNET_TESTING_TopologyOption options,
double option_modifier,
+ struct GNUNET_TIME_Relative connect_timeout,
+ unsigned int connect_attempts,
GNUNET_TESTING_NotifyCompletion
notify_callback, void *notify_cls)
{
@@ -4480,7 +4522,7 @@
break;
}
- return connect_topology (pg, notify_callback, notify_cls);
+ return connect_topology (pg, connect_timeout, connect_attempts,
notify_callback, notify_cls);
}
/**
@@ -4547,7 +4589,7 @@
return;
}
- if (internal_context->peer->pg->starting < MAX_CONCURRENT_STARTING)
+ if (internal_context->peer->pg->starting <
internal_context->peer->pg->max_outstanding_connections)
{
internal_context->peer->pg->starting++;
GNUNET_TESTING_daemon_continue_startup (internal_context->peer->daemon);
@@ -4630,7 +4672,7 @@
struct ChurnRestartContext *startup_ctx =
peer_restart_ctx->churn_restart_ctx;
- if (startup_ctx->outstanding > MAX_CONCURRENT_STARTING)
+ if (startup_ctx->outstanding > startup_ctx->pg->max_outstanding_connections)
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100),
&schedule_churn_restart, peer_restart_ctx);
@@ -4706,6 +4748,8 @@
*
* @param cfg configuration template to use
* @param total number of daemons to start
+ * @param max_concurrent_connections for testing, how many peers can
+ * we connect to simultaneously
* @param timeout total time allowed for peers to start
* @param hostkey_callback function to call on each peers hostkey generation
* if NULL, peers will be started by this call, if non-null,
@@ -4724,6 +4768,7 @@
struct GNUNET_TESTING_PeerGroup *
GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int total,
+ unsigned int max_concurrent_connections,
struct GNUNET_TIME_Relative timeout,
GNUNET_TESTING_NotifyHostkeyCreated
hostkey_callback, void *hostkey_cls,
@@ -4776,6 +4821,7 @@
pg->total = total;
pg->max_timeout = GNUNET_TIME_relative_to_absolute (timeout);
pg->peers = GNUNET_malloc (total * sizeof (struct PeerData));
+ pg->max_outstanding_connections = max_concurrent_connections;
if (NULL != hostnames)
{
off = 0;
@@ -5176,12 +5222,12 @@
{
struct PeerShutdownContext *peer_shutdown_ctx = cls;
struct ShutdownContext *shutdown_ctx;
-
+ struct ChurnContext *churn_ctx;
GNUNET_assert (peer_shutdown_ctx != NULL);
shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
GNUNET_assert (shutdown_ctx != NULL);
-
- if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN)
+ churn_ctx = (struct ChurnContext *)shutdown_ctx->cb_cls;
+ if (shutdown_ctx->outstanding > churn_ctx->pg->max_outstanding_connections)
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100),
&schedule_churn_shutdown_task,
@@ -5308,6 +5354,7 @@
churn_ctx->num_to_stop = voff;
churn_ctx->cb = cb;
churn_ctx->cb_cls = cb_cls;
+ churn_ctx->pg = pg;
for (i = 0; i < pg->total; i++)
{
@@ -5362,6 +5409,7 @@
churn_startup_ctx = GNUNET_malloc (sizeof (struct ChurnRestartContext));
churn_startup_ctx->churn_ctx = churn_ctx;
churn_startup_ctx->timeout = timeout;
+ churn_startup_ctx->pg = pg;
}
for (i = 0; i < von; i++)
{
@@ -5529,7 +5577,7 @@
shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
GNUNET_assert (shutdown_ctx != NULL);
- if (shutdown_ctx->outstanding > MAX_CONCURRENT_SHUTDOWN)
+ if (shutdown_ctx->outstanding >
shutdown_ctx->pg->max_outstanding_connections)
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100),
&schedule_shutdown_task, peer_shutdown_ctx);
@@ -5572,6 +5620,7 @@
shutdown_ctx->cb_cls = cb_cls;
shutdown_ctx->total_peers = pg->total;
shutdown_ctx->timeout = timeout;
+ shutdown_ctx->pg = pg;
/* shtudown_ctx->outstanding = 0; */
for (off = 0; off < pg->total; off++)
Modified: gnunet/src/topology/test_gnunet_daemon_topology.c
===================================================================
--- gnunet/src/topology/test_gnunet_daemon_topology.c 2011-02-05 13:48:42 UTC
(rev 14355)
+++ gnunet/src/topology/test_gnunet_daemon_topology.c 2011-02-05 14:19:42 UTC
(rev 14356)
@@ -154,6 +154,7 @@
peers_left = NUM_PEERS;
pg = GNUNET_TESTING_daemons_start (cfg,
peers_left,
+ peers_left,
TIMEOUT,
NULL, NULL,
&my_cb, NULL, NULL, NULL, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14356 - in gnunet/src: dht fs include testing topology,
gnunet <=