diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-22 11:44:04 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-22 11:44:04 +0000 |
commit | f54cf6c01e2dac998c64249d72eb92dbf5d056db (patch) | |
tree | 18ed9fed6accd78bf526c2d959644d8efeee9abe | |
parent | 76f59cc8768739288704cd3f6d3864760be035d0 (diff) | |
download | gnunet-f54cf6c01e2dac998c64249d72eb92dbf5d056db.tar.gz gnunet-f54cf6c01e2dac998c64249d72eb92dbf5d056db.zip |
option for disabling auto retry
-rw-r--r-- | src/include/gnunet_testbed_service.h | 26 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 4 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_topology.c | 2 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 31 |
4 files changed, 51 insertions, 12 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index ed7251ed3..e63030fbd 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -908,7 +908,8 @@ GNUNET_TESTBED_underlay_configure_link (void *op_cls, | |||
908 | 908 | ||
909 | 909 | ||
910 | /** | 910 | /** |
911 | * Topologies supported for testbeds. | 911 | * Topologies and topology options supported for testbeds. Options should always |
912 | * end with GNUNET_TESTBED_TOPOLOGY_OPTION_END | ||
912 | */ | 913 | */ |
913 | enum GNUNET_TESTBED_TopologyOption | 914 | enum GNUNET_TESTBED_TopologyOption |
914 | { | 915 | { |
@@ -940,9 +941,8 @@ enum GNUNET_TESTBED_TopologyOption | |||
940 | GNUNET_TESTBED_TOPOLOGY_2D_TORUS, | 941 | GNUNET_TESTBED_TOPOLOGY_2D_TORUS, |
941 | 942 | ||
942 | /** | 943 | /** |
943 | * Random graph. Followed by the link density, that is the | 944 | * Random graph. Followed by the number of random links to be established |
944 | * percentage of links present in relation to a clique | 945 | * (unsigned int) |
945 | * (float). | ||
946 | */ | 946 | */ |
947 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 947 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
948 | 948 | ||
@@ -971,7 +971,23 @@ enum GNUNET_TESTBED_TopologyOption | |||
971 | /** | 971 | /** |
972 | * Read a topology from a given file. Followed by the name of the file (const char *). | 972 | * Read a topology from a given file. Followed by the name of the file (const char *). |
973 | */ | 973 | */ |
974 | GNUNET_TESTBED_TOPOLOGY_FROM_FILE | 974 | GNUNET_TESTBED_TOPOLOGY_FROM_FILE, |
975 | |||
976 | /** | ||
977 | * The options should always end with this | ||
978 | */ | ||
979 | GNUNET_TESTBED_TOPOLOGY_OPTION_END, | ||
980 | |||
981 | /* The following are not topologies but influence how the topology has to be | ||
982 | setup. These options should follow the topology specific options (if | ||
983 | required by the chosen topology). Note that these should be given before | ||
984 | GNUNET_TESTBED_TOPOLOGY_OPTION_END */ | ||
985 | |||
986 | /** | ||
987 | * Disable automatic retrying for failed overlay connections. The default is | ||
988 | * to always retry failed overlay connections. This parameter takes no options. | ||
989 | */ | ||
990 | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY | ||
975 | }; | 991 | }; |
976 | 992 | ||
977 | 993 | ||
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 21faaa74a..b01e992b9 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -334,8 +334,8 @@ peer_churn_cb (void *cls, const char *emsg) | |||
334 | topology_op = | 334 | topology_op = |
335 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, | 335 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, |
336 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 336 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
337 | 337 | num_links, | |
338 | num_links); | 338 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c index 8e673d293..af3890ea5 100644 --- a/src/testbed/test_testbed_api_topology.c +++ b/src/testbed/test_testbed_api_topology.c | |||
@@ -136,7 +136,7 @@ test_master (void *cls, unsigned int num_peers, | |||
136 | overlay_connects = 0; | 136 | overlay_connects = 0; |
137 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, | 137 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, |
138 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 138 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
139 | NUM_PEERS); | 139 | NUM_PEERS, GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
140 | GNUNET_assert (NULL != op); | 140 | GNUNET_assert (NULL != op); |
141 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 141 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
142 | (GNUNET_TIME_UNIT_SECONDS, 120), | 142 | (GNUNET_TIME_UNIT_SECONDS, 120), |
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index bc766dedb..08d812e5e 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c | |||
@@ -94,7 +94,12 @@ struct TopologyContext | |||
94 | /** | 94 | /** |
95 | * The size of the link array | 95 | * The size of the link array |
96 | */ | 96 | */ |
97 | unsigned int link_array_size; | 97 | unsigned int link_array_size; |
98 | |||
99 | /** | ||
100 | * should the automatic retry be disabled | ||
101 | */ | ||
102 | int disable_retry; | ||
98 | 103 | ||
99 | }; | 104 | }; |
100 | 105 | ||
@@ -117,10 +122,10 @@ overlay_link_completed (void *cls, | |||
117 | 122 | ||
118 | GNUNET_assert (op == link->op); | 123 | GNUNET_assert (op == link->op); |
119 | GNUNET_TESTBED_operation_done (op); | 124 | GNUNET_TESTBED_operation_done (op); |
120 | link->op = NULL; | 125 | link->op = NULL; |
121 | if (NULL != emsg) | 126 | tc = link->tc; |
127 | if ((NULL != emsg) && (GNUNET_NO == tc->disable_retry)) | ||
122 | { | 128 | { |
123 | tc = link->tc; | ||
124 | LOG (GNUNET_ERROR_TYPE_WARNING, | 129 | LOG (GNUNET_ERROR_TYPE_WARNING, |
125 | "Error while establishing a link: %s -- Retrying\n", emsg); | 130 | "Error while establishing a link: %s -- Retrying\n", emsg); |
126 | link->op = | 131 | link->op = |
@@ -251,6 +256,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
251 | struct TopologyContext *tc; | 256 | struct TopologyContext *tc; |
252 | struct GNUNET_TESTBED_Operation *op; | 257 | struct GNUNET_TESTBED_Operation *op; |
253 | struct GNUNET_TESTBED_Controller *c; | 258 | struct GNUNET_TESTBED_Controller *c; |
259 | enum GNUNET_TESTBED_TopologyOption secondary_option; | ||
254 | unsigned int cnt; | 260 | unsigned int cnt; |
255 | 261 | ||
256 | if (num_peers < 2) | 262 | if (num_peers < 2) |
@@ -296,6 +302,22 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
296 | GNUNET_break (0); | 302 | GNUNET_break (0); |
297 | return NULL; | 303 | return NULL; |
298 | } | 304 | } |
305 | do | ||
306 | { | ||
307 | secondary_option = va_arg (va, enum GNUNET_TESTBED_TopologyOption); | ||
308 | switch (secondary_option) | ||
309 | { | ||
310 | case GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY: | ||
311 | tc->disable_retry = GNUNET_YES; | ||
312 | break; | ||
313 | case GNUNET_TESTBED_TOPOLOGY_OPTION_END: | ||
314 | break; | ||
315 | default: | ||
316 | GNUNET_break (0); /* Should not use any other option apart from | ||
317 | the ones handled here */ | ||
318 | return NULL; | ||
319 | } | ||
320 | } while (GNUNET_TESTBED_TOPOLOGY_OPTION_END != secondary_option); | ||
299 | op = GNUNET_TESTBED_operation_create_ (tc, | 321 | op = GNUNET_TESTBED_operation_create_ (tc, |
300 | &opstart_overlay_configure_topology, | 322 | &opstart_overlay_configure_topology, |
301 | &oprelease_overlay_configure_topology); | 323 | &oprelease_overlay_configure_topology); |
@@ -328,6 +350,7 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers, | |||
328 | struct GNUNET_TESTBED_Operation *op; | 350 | struct GNUNET_TESTBED_Operation *op; |
329 | va_list vargs; | 351 | va_list vargs; |
330 | 352 | ||
353 | GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); | ||
331 | va_start (vargs, topo); | 354 | va_start (vargs, topo); |
332 | op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, | 355 | op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, |
333 | topo, vargs); | 356 | topo, vargs); |