diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-05 14:24:51 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-05 14:24:51 +0000 |
commit | 28f8e239844323e564d63fc8a792cbcbed41ec68 (patch) | |
tree | bce0c4fb0a962e990f410db68f503aa87da8bbb1 | |
parent | 01cc59a2f217ca02635beaf533decb1683339dd9 (diff) | |
download | gnunet-28f8e239844323e564d63fc8a792cbcbed41ec68.tar.gz gnunet-28f8e239844323e564d63fc8a792cbcbed41ec68.zip |
add completion callback for overlay topology configure functions
-rw-r--r-- | src/gns/test_gns_dht_three_peers.c | 3 | ||||
-rw-r--r-- | src/include/gnunet_testbed_service.h | 41 | ||||
-rw-r--r-- | src/regex/gnunet-regex-profiler.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_topology.c | 2 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_topology_clique.c | 2 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 6 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 160 |
7 files changed, 191 insertions, 28 deletions
diff --git a/src/gns/test_gns_dht_three_peers.c b/src/gns/test_gns_dht_three_peers.c index 5c4e54e13..49c94571f 100644 --- a/src/gns/test_gns_dht_three_peers.c +++ b/src/gns/test_gns_dht_three_peers.c | |||
@@ -296,7 +296,8 @@ static void connect_peers () | |||
296 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers started\n"); | 296 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers started\n"); |
297 | 297 | ||
298 | topology_op = | 298 | topology_op = |
299 | GNUNET_TESTBED_overlay_configure_topology (NULL, 3, cpeers, | 299 | GNUNET_TESTBED_overlay_configure_topology (NULL, 3, cpeers, NULL, |
300 | NULL, | ||
300 | NULL, | 301 | NULL, |
301 | GNUNET_TESTBED_TOPOLOGY_RING, | 302 | GNUNET_TESTBED_TOPOLOGY_RING, |
302 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 303 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index 01d7f7f93..3c2d93272 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -1025,10 +1025,13 @@ enum GNUNET_TESTBED_TopologyOption | |||
1025 | GNUNET_TESTBED_TOPOLOGY_OPTION_END */ | 1025 | GNUNET_TESTBED_TOPOLOGY_OPTION_END */ |
1026 | 1026 | ||
1027 | /** | 1027 | /** |
1028 | * Disable automatic retrying for failed overlay connections. The default is | 1028 | * How many times should the failed overlay connect operations be retried |
1029 | * to always retry failed overlay connections. This parameter takes no options. | 1029 | * before giving up. The default if this option is not specified is to retry |
1030 | * 3 times. This option takes and unsigned integer as a parameter. Use this | ||
1031 | * option with parameter 0 to disable retrying of failed overlay connect | ||
1032 | * operations. | ||
1030 | */ | 1033 | */ |
1031 | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY | 1034 | GNUNET_TESTBED_TOPOLOGY_RETRY_CNT |
1032 | }; | 1035 | }; |
1033 | 1036 | ||
1034 | 1037 | ||
@@ -1093,15 +1096,33 @@ GNUNET_TESTBED_overlay_connect (void *op_cls, | |||
1093 | 1096 | ||
1094 | 1097 | ||
1095 | /** | 1098 | /** |
1099 | * Callbacks of this type are called when topology configuration is completed | ||
1100 | * | ||
1101 | * @param cls the operation closure given to | ||
1102 | * GNUNET_TESTBED_overlay_configure_topology_va() and | ||
1103 | * GNUNET_TESTBED_overlay_configure() calls | ||
1104 | * @param nsuccess the number of successful overlay connects | ||
1105 | * @param nfailures the number of overlay connects which failed | ||
1106 | */ | ||
1107 | typedef void (*GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, | ||
1108 | unsigned int nsuccess, | ||
1109 | unsigned int nfailures); | ||
1110 | |||
1111 | |||
1112 | /** | ||
1096 | * All peers must have been started before calling this function. | 1113 | * All peers must have been started before calling this function. |
1097 | * This function then connects the given peers in the P2P overlay | 1114 | * This function then connects the given peers in the P2P overlay |
1098 | * using the given topology. | 1115 | * using the given topology. |
1099 | * | 1116 | * |
1100 | * @param op_cls closure argument to give with the operation event | 1117 | * @param op_cls closure argument to give with the peer connect operation events |
1118 | * generated through this function | ||
1101 | * @param num_peers number of peers in 'peers' | 1119 | * @param num_peers number of peers in 'peers' |
1102 | * @param peers array of 'num_peers' with the peers to configure | 1120 | * @param peers array of 'num_peers' with the peers to configure |
1103 | * @param max_connections the maximums number of overlay connections that will | 1121 | * @param max_connections the maximums number of overlay connections that will |
1104 | * be made to achieve the given topology | 1122 | * be made to achieve the given topology |
1123 | * @param comp_cb the completion callback to call when the topology generation | ||
1124 | * is completed | ||
1125 | * @param comp_cb_cls closure for the above completion callback | ||
1105 | * @param topo desired underlay topology to use | 1126 | * @param topo desired underlay topology to use |
1106 | * @param va topology-specific options | 1127 | * @param va topology-specific options |
1107 | * @return handle to the operation, NULL if connecting these | 1128 | * @return handle to the operation, NULL if connecting these |
@@ -1113,6 +1134,9 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
1113 | unsigned int num_peers, | 1134 | unsigned int num_peers, |
1114 | struct GNUNET_TESTBED_Peer **peers, | 1135 | struct GNUNET_TESTBED_Peer **peers, |
1115 | unsigned int *max_connections, | 1136 | unsigned int *max_connections, |
1137 | GNUNET_TESTBED_TopologyCompletionCallback | ||
1138 | comp_cb, | ||
1139 | void *comp_cb_cls, | ||
1116 | enum GNUNET_TESTBED_TopologyOption topo, | 1140 | enum GNUNET_TESTBED_TopologyOption topo, |
1117 | va_list va); | 1141 | va_list va); |
1118 | 1142 | ||
@@ -1122,11 +1146,15 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
1122 | * This function then connects the given peers in the P2P overlay | 1146 | * This function then connects the given peers in the P2P overlay |
1123 | * using the given topology. | 1147 | * using the given topology. |
1124 | * | 1148 | * |
1125 | * @param op_cls closure argument to give with the operation event | 1149 | * @param op_cls closure argument to give with the peer connect operation events |
1150 | * generated through this function | ||
1126 | * @param num_peers number of peers in 'peers' | 1151 | * @param num_peers number of peers in 'peers' |
1127 | * @param peers array of 'num_peers' with the peers to configure | 1152 | * @param peers array of 'num_peers' with the peers to configure |
1128 | * @param max_connections the maximums number of overlay connections that will | 1153 | * @param max_connections the maximums number of overlay connections that will |
1129 | * be made to achieve the given topology | 1154 | * be made to achieve the given topology |
1155 | * @param comp_cb the completion callback to call when the topology generation | ||
1156 | * is completed | ||
1157 | * @param comp_cb_cls closure for the above completion callback | ||
1130 | * @param topo desired underlay topology to use | 1158 | * @param topo desired underlay topology to use |
1131 | * @param ... topology-specific options | 1159 | * @param ... topology-specific options |
1132 | * @return handle to the operation, NULL if connecting these | 1160 | * @return handle to the operation, NULL if connecting these |
@@ -1138,6 +1166,9 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, | |||
1138 | unsigned int num_peers, | 1166 | unsigned int num_peers, |
1139 | struct GNUNET_TESTBED_Peer **peers, | 1167 | struct GNUNET_TESTBED_Peer **peers, |
1140 | unsigned int *max_connections, | 1168 | unsigned int *max_connections, |
1169 | GNUNET_TESTBED_TopologyCompletionCallback | ||
1170 | comp_cb, | ||
1171 | void *comp_cb_cls, | ||
1141 | enum GNUNET_TESTBED_TopologyOption topo, | 1172 | enum GNUNET_TESTBED_TopologyOption topo, |
1142 | ...); | 1173 | ...); |
1143 | 1174 | ||
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 26c052387..f0a05c457 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -1107,9 +1107,12 @@ do_configure_topology (void *cls, | |||
1107 | topology_op = | 1107 | topology_op = |
1108 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, | 1108 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, |
1109 | NULL, | 1109 | NULL, |
1110 | NULL, | ||
1111 | NULL, | ||
1110 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 1112 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
1111 | num_links, | 1113 | num_links, |
1112 | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, | 1114 | GNUNET_TESTBED_TOPOLOGY_RETRY_CNT, |
1115 | (unsigned int) 0, | ||
1113 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 1116 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
1114 | if (NULL == topology_op) | 1117 | if (NULL == topology_op) |
1115 | { | 1118 | { |
diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c index a63ae1b1a..0098dbea4 100644 --- a/src/testbed/test_testbed_api_topology.c +++ b/src/testbed/test_testbed_api_topology.c | |||
@@ -135,6 +135,8 @@ test_master (void *cls, unsigned int num_peers, | |||
135 | peers = peers_; | 135 | peers = peers_; |
136 | overlay_connects = 0; | 136 | overlay_connects = 0; |
137 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL, | 137 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL, |
138 | NULL, | ||
139 | NULL, | ||
138 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 140 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
139 | NUM_PEERS, | 141 | NUM_PEERS, |
140 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 142 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c index eb6254b10..3f1ed7ade 100644 --- a/src/testbed/test_testbed_api_topology_clique.c +++ b/src/testbed/test_testbed_api_topology_clique.c | |||
@@ -130,6 +130,8 @@ test_master (void *cls, unsigned int num_peers, | |||
130 | peers = peers_; | 130 | peers = peers_; |
131 | overlay_connects = 0; | 131 | overlay_connects = 0; |
132 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL, | 132 | op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL, |
133 | NULL, | ||
134 | NULL, | ||
133 | GNUNET_TESTBED_TOPOLOGY_CLIQUE, | 135 | GNUNET_TESTBED_TOPOLOGY_CLIQUE, |
134 | /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */ | 136 | /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */ |
135 | /* NUM_PEERS, */ | 137 | /* NUM_PEERS, */ |
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 47e0edc89..1c9363c63 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -735,6 +735,8 @@ call_cc: | |||
735 | rc->topology_operation = | 735 | rc->topology_operation = |
736 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, | 736 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
737 | rc->peers, &rc->num_oc, | 737 | rc->peers, &rc->num_oc, |
738 | NULL, | ||
739 | NULL, | ||
738 | rc->topology, | 740 | rc->topology, |
739 | rc->random_links, | 741 | rc->random_links, |
740 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 742 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
@@ -745,6 +747,8 @@ call_cc: | |||
745 | rc->topology_operation = | 747 | rc->topology_operation = |
746 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, | 748 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
747 | rc->peers, &rc->num_oc, | 749 | rc->peers, &rc->num_oc, |
750 | NULL, | ||
751 | NULL, | ||
748 | rc->topology, | 752 | rc->topology, |
749 | rc->topo_file, | 753 | rc->topo_file, |
750 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 754 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
@@ -753,6 +757,8 @@ call_cc: | |||
753 | rc->topology_operation = | 757 | rc->topology_operation = |
754 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, | 758 | GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers, |
755 | rc->peers, &rc->num_oc, | 759 | rc->peers, &rc->num_oc, |
760 | NULL, | ||
761 | NULL, | ||
756 | rc->topology, | 762 | rc->topology, |
757 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 763 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
758 | if (NULL == rc->topology_operation) | 764 | if (NULL == rc->topology_operation) |
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index d9666e4df..9618f98dd 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c | |||
@@ -38,6 +38,12 @@ | |||
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Default number of retires | ||
42 | */ | ||
43 | #define DEFAULT_RETRY_CNT 3 | ||
44 | |||
45 | |||
46 | /** | ||
41 | * Context information for topology operations | 47 | * Context information for topology operations |
42 | */ | 48 | */ |
43 | struct TopologyContext; | 49 | struct TopologyContext; |
@@ -72,6 +78,25 @@ struct OverlayLink | |||
72 | }; | 78 | }; |
73 | 79 | ||
74 | 80 | ||
81 | struct RetryListEntry | ||
82 | { | ||
83 | /** | ||
84 | * the next pointer for the DLL | ||
85 | */ | ||
86 | struct RetryListEntry *next; | ||
87 | |||
88 | /** | ||
89 | * the prev pointer for the DLL | ||
90 | */ | ||
91 | struct RetryListEntry *prev; | ||
92 | |||
93 | /** | ||
94 | * The link to be retired | ||
95 | */ | ||
96 | struct OverlayLink *link; | ||
97 | }; | ||
98 | |||
99 | |||
75 | /** | 100 | /** |
76 | * Context information for topology operations | 101 | * Context information for topology operations |
77 | */ | 102 | */ |
@@ -93,6 +118,26 @@ struct TopologyContext | |||
93 | void *op_cls; | 118 | void *op_cls; |
94 | 119 | ||
95 | /** | 120 | /** |
121 | * topology generation completion callback | ||
122 | */ | ||
123 | GNUNET_TESTBED_TopologyCompletionCallback comp_cb; | ||
124 | |||
125 | /** | ||
126 | * The closure for the above callback | ||
127 | */ | ||
128 | void *comp_cb_cls; | ||
129 | |||
130 | /** | ||
131 | * DLL head for retry list | ||
132 | */ | ||
133 | struct RetryListEntry *rl_head; | ||
134 | |||
135 | /** | ||
136 | * DLL tail for retry list | ||
137 | */ | ||
138 | struct RetryListEntry *rl_tail; | ||
139 | |||
140 | /** | ||
96 | * The number of peers | 141 | * The number of peers |
97 | */ | 142 | */ |
98 | unsigned int num_peers; | 143 | unsigned int num_peers; |
@@ -103,10 +148,29 @@ struct TopologyContext | |||
103 | unsigned int link_array_size; | 148 | unsigned int link_array_size; |
104 | 149 | ||
105 | /** | 150 | /** |
106 | * should the automatic retry be disabled | 151 | * How many retries to do before we give up |
107 | */ | 152 | */ |
108 | int disable_retry; | 153 | unsigned int retry_cnt; |
109 | 154 | ||
155 | /** | ||
156 | * Number of links to try | ||
157 | */ | ||
158 | unsigned int nlinks; | ||
159 | |||
160 | /** | ||
161 | * How many links have been completed | ||
162 | */ | ||
163 | unsigned int ncompleted; | ||
164 | |||
165 | /** | ||
166 | * Total successfully established overlay connections | ||
167 | */ | ||
168 | unsigned int nsuccess; | ||
169 | |||
170 | /** | ||
171 | * Total failed overlay connections | ||
172 | */ | ||
173 | unsigned int nfailures; | ||
110 | }; | 174 | }; |
111 | 175 | ||
112 | 176 | ||
@@ -198,21 +262,51 @@ overlay_link_completed (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
198 | { | 262 | { |
199 | struct OverlayLink *link = cls; | 263 | struct OverlayLink *link = cls; |
200 | struct TopologyContext *tc; | 264 | struct TopologyContext *tc; |
265 | struct RetryListEntry *retry_entry; | ||
201 | 266 | ||
202 | GNUNET_assert (op == link->op); | 267 | GNUNET_assert (op == link->op); |
203 | GNUNET_TESTBED_operation_done (op); | 268 | GNUNET_TESTBED_operation_done (op); |
204 | link->op = NULL; | 269 | link->op = NULL; |
205 | tc = link->tc; | 270 | tc = link->tc; |
206 | if ((NULL != emsg) && (GNUNET_NO == tc->disable_retry)) | 271 | if (NULL != emsg) |
207 | { | 272 | { |
208 | LOG (GNUNET_ERROR_TYPE_WARNING, | 273 | tc->nfailures++; |
209 | "Error while establishing a link: %s -- Retrying\n", emsg); | 274 | if (0 != tc->retry_cnt) |
210 | link->op = | 275 | { |
211 | GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed, | 276 | LOG (GNUNET_ERROR_TYPE_WARNING, |
212 | link, tc->peers[link->A], | 277 | "Error while establishing a link: %s -- Retrying\n", emsg); |
213 | tc->peers[link->B]); | 278 | retry_entry = GNUNET_malloc (sizeof (struct RetryListEntry)); |
279 | retry_entry->link = link; | ||
280 | GNUNET_CONTAINER_DLL_insert_tail (tc->rl_head, tc->rl_tail, retry_entry); | ||
281 | } | ||
282 | } | ||
283 | else | ||
284 | tc->nsuccess++; | ||
285 | tc->ncompleted++; | ||
286 | if (tc->ncompleted < tc->nlinks) | ||
287 | return; | ||
288 | if ((0 != tc->retry_cnt) && (NULL != tc->rl_head)) | ||
289 | { | ||
290 | tc->retry_cnt--; | ||
291 | tc->ncompleted = 0; | ||
292 | tc->nlinks = 0; | ||
293 | while (NULL != (retry_entry = tc->rl_head)) | ||
294 | { | ||
295 | link = retry_entry->link; | ||
296 | link->op = | ||
297 | GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed, | ||
298 | link, tc->peers[link->A], | ||
299 | tc->peers[link->B]); | ||
300 | tc->nlinks++; | ||
301 | GNUNET_CONTAINER_DLL_remove (tc->rl_head, tc->rl_tail, retry_entry); | ||
302 | GNUNET_free (retry_entry); | ||
303 | } | ||
214 | return; | 304 | return; |
215 | } | 305 | } |
306 | if (NULL != tc->comp_cb) | ||
307 | { | ||
308 | tc->comp_cb (tc->comp_cb_cls, tc->nsuccess, tc->nfailures); | ||
309 | } | ||
216 | } | 310 | } |
217 | 311 | ||
218 | 312 | ||
@@ -228,6 +322,7 @@ opstart_overlay_configure_topology (void *cls) | |||
228 | struct TopologyContext *tc = cls; | 322 | struct TopologyContext *tc = cls; |
229 | unsigned int p; | 323 | unsigned int p; |
230 | 324 | ||
325 | tc->nlinks = tc->link_array_size; | ||
231 | for (p = 0; p < tc->link_array_size; p++) | 326 | for (p = 0; p < tc->link_array_size; p++) |
232 | { | 327 | { |
233 | tc->link_array[p].op = | 328 | tc->link_array[p].op = |
@@ -248,8 +343,14 @@ static void | |||
248 | oprelease_overlay_configure_topology (void *cls) | 343 | oprelease_overlay_configure_topology (void *cls) |
249 | { | 344 | { |
250 | struct TopologyContext *tc = cls; | 345 | struct TopologyContext *tc = cls; |
346 | struct RetryListEntry *retry_entry; | ||
251 | unsigned int p; | 347 | unsigned int p; |
252 | 348 | ||
349 | while (NULL != (retry_entry = tc->rl_head)) | ||
350 | { | ||
351 | GNUNET_CONTAINER_DLL_remove (tc->rl_head, tc->rl_tail, retry_entry); | ||
352 | GNUNET_free (retry_entry); | ||
353 | } | ||
253 | if (NULL != tc->link_array) | 354 | if (NULL != tc->link_array) |
254 | { | 355 | { |
255 | for (p = 0; p < tc->link_array_size; p++) | 356 | for (p = 0; p < tc->link_array_size; p++) |
@@ -741,11 +842,15 @@ GNUNET_TESTBED_underlay_configure_topology (void *op_cls, | |||
741 | * This function then connects the given peers in the P2P overlay | 842 | * This function then connects the given peers in the P2P overlay |
742 | * using the given topology. | 843 | * using the given topology. |
743 | * | 844 | * |
744 | * @param op_cls closure argument to give with the operation event | 845 | * @param op_cls closure argument to give with the peer connect operation events |
846 | * generated through this function | ||
745 | * @param num_peers number of peers in 'peers' | 847 | * @param num_peers number of peers in 'peers' |
746 | * @param peers array of 'num_peers' with the peers to configure | 848 | * @param peers array of 'num_peers' with the peers to configure |
747 | * @param max_connections the maximums number of overlay connections that will | 849 | * @param max_connections the maximums number of overlay connections that will |
748 | * be made to achieve the given topology | 850 | * be made to achieve the given topology |
851 | * @param comp_cb the completion callback to call when the topology generation | ||
852 | * is completed | ||
853 | * @param comp_cb_cls closure for the above completion callback | ||
749 | * @param topo desired underlay topology to use | 854 | * @param topo desired underlay topology to use |
750 | * @param va topology-specific options | 855 | * @param va topology-specific options |
751 | * @return handle to the operation, NULL if connecting these | 856 | * @return handle to the operation, NULL if connecting these |
@@ -755,11 +860,13 @@ GNUNET_TESTBED_underlay_configure_topology (void *op_cls, | |||
755 | struct GNUNET_TESTBED_Operation * | 860 | struct GNUNET_TESTBED_Operation * |
756 | GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | 861 | GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, |
757 | unsigned int num_peers, | 862 | unsigned int num_peers, |
758 | struct GNUNET_TESTBED_Peer | 863 | struct GNUNET_TESTBED_Peer **peers, |
759 | **peers, | ||
760 | unsigned int *max_connections, | 864 | unsigned int *max_connections, |
761 | enum GNUNET_TESTBED_TopologyOption | 865 | GNUNET_TESTBED_TopologyCompletionCallback |
762 | topo, va_list va) | 866 | comp_cb, |
867 | void *comp_cb_cls, | ||
868 | enum GNUNET_TESTBED_TopologyOption topo, | ||
869 | va_list va) | ||
763 | { | 870 | { |
764 | struct TopologyContext *tc; | 871 | struct TopologyContext *tc; |
765 | struct GNUNET_TESTBED_Operation *op; | 872 | struct GNUNET_TESTBED_Operation *op; |
@@ -774,6 +881,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
774 | tc->peers = peers; | 881 | tc->peers = peers; |
775 | tc->num_peers = num_peers; | 882 | tc->num_peers = num_peers; |
776 | tc->op_cls = op_cls; | 883 | tc->op_cls = op_cls; |
884 | tc->retry_cnt = DEFAULT_RETRY_CNT; | ||
777 | switch (topo) | 885 | switch (topo) |
778 | { | 886 | { |
779 | case GNUNET_TESTBED_TOPOLOGY_LINE: | 887 | case GNUNET_TESTBED_TOPOLOGY_LINE: |
@@ -847,8 +955,8 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
847 | 955 | ||
848 | switch (secondary_option) | 956 | switch (secondary_option) |
849 | { | 957 | { |
850 | case GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY: | 958 | case GNUNET_TESTBED_TOPOLOGY_RETRY_CNT: |
851 | tc->disable_retry = GNUNET_YES; | 959 | tc->retry_cnt = va_arg (va, unsigned int); |
852 | break; | 960 | break; |
853 | case GNUNET_TESTBED_TOPOLOGY_OPTION_END: | 961 | case GNUNET_TESTBED_TOPOLOGY_OPTION_END: |
854 | break; | 962 | break; |
@@ -880,11 +988,15 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
880 | * This function then connects the given peers in the P2P overlay | 988 | * This function then connects the given peers in the P2P overlay |
881 | * using the given topology. | 989 | * using the given topology. |
882 | * | 990 | * |
883 | * @param op_cls closure argument to give with the operation event | 991 | * @param op_cls closure argument to give with the peer connect operation events |
992 | * generated through this function | ||
884 | * @param num_peers number of peers in 'peers' | 993 | * @param num_peers number of peers in 'peers' |
885 | * @param peers array of 'num_peers' with the peers to configure | 994 | * @param peers array of 'num_peers' with the peers to configure |
886 | * @param max_connections the maximums number of overlay connections that will | 995 | * @param max_connections the maximums number of overlay connections that will |
887 | * be made to achieve the given topology | 996 | * be made to achieve the given topology |
997 | * @param comp_cb the completion callback to call when the topology generation | ||
998 | * is completed | ||
999 | * @param comp_cb_cls closure for the above completion callback | ||
888 | * @param topo desired underlay topology to use | 1000 | * @param topo desired underlay topology to use |
889 | * @param ... topology-specific options | 1001 | * @param ... topology-specific options |
890 | * @return handle to the operation, NULL if connecting these | 1002 | * @return handle to the operation, NULL if connecting these |
@@ -892,11 +1004,15 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
892 | * not running or underlay disallows) or if num_peers is less than 2 | 1004 | * not running or underlay disallows) or if num_peers is less than 2 |
893 | */ | 1005 | */ |
894 | struct GNUNET_TESTBED_Operation * | 1006 | struct GNUNET_TESTBED_Operation * |
895 | GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers, | 1007 | GNUNET_TESTBED_overlay_configure_topology (void *op_cls, |
1008 | unsigned int num_peers, | ||
896 | struct GNUNET_TESTBED_Peer **peers, | 1009 | struct GNUNET_TESTBED_Peer **peers, |
897 | unsigned int *max_connections, | 1010 | unsigned int *max_connections, |
898 | enum GNUNET_TESTBED_TopologyOption | 1011 | GNUNET_TESTBED_TopologyCompletionCallback |
899 | topo, ...) | 1012 | comp_cb, |
1013 | void *comp_cb_cls, | ||
1014 | enum GNUNET_TESTBED_TopologyOption topo, | ||
1015 | ...) | ||
900 | { | 1016 | { |
901 | struct GNUNET_TESTBED_Operation *op; | 1017 | struct GNUNET_TESTBED_Operation *op; |
902 | va_list vargs; | 1018 | va_list vargs; |
@@ -904,7 +1020,9 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers, | |||
904 | GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 1020 | GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
905 | va_start (vargs, topo); | 1021 | va_start (vargs, topo); |
906 | op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, | 1022 | op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers, |
907 | max_connections, topo, | 1023 | max_connections, |
1024 | comp_cb, comp_cb_cls, | ||
1025 | topo, | ||
908 | vargs); | 1026 | vargs); |
909 | va_end (vargs); | 1027 | va_end (vargs); |
910 | return op; | 1028 | return op; |