diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-11-02 14:34:27 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-11-02 14:34:27 +0000 |
commit | 5d4dd95a17d90d532b52e1060dd259f80a333931 (patch) | |
tree | cbce3e30515d17f551814c7bfed09df72bf7f11a /src/mesh/test_mesh_path_api.c | |
parent | 5510235d61541aa1a52544918d8f3605efb40b5a (diff) | |
download | gnunet-5d4dd95a17d90d532b52e1060dd259f80a333931.tar.gz gnunet-5d4dd95a17d90d532b52e1060dd259f80a333931.zip |
Make tree library independent from tunnels, add cls to callbacks
Diffstat (limited to 'src/mesh/test_mesh_path_api.c')
-rw-r--r-- | src/mesh/test_mesh_path_api.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesh/test_mesh_path_api.c b/src/mesh/test_mesh_path_api.c index e7c2a6fdf..45c4f3c14 100644 --- a/src/mesh/test_mesh_path_api.c +++ b/src/mesh/test_mesh_path_api.c | |||
@@ -40,9 +40,9 @@ struct GNUNET_PeerIdentity* pi[10]; | |||
40 | struct MeshTunnelTree *tree; | 40 | struct MeshTunnelTree *tree; |
41 | 41 | ||
42 | static void | 42 | static void |
43 | cb (const struct MeshTunnelTreeNode *n) | 43 | cb (void *cls, GNUNET_PEER_Id peer_id) |
44 | { | 44 | { |
45 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: CB: Disconnected %u\n", n->peer); | 45 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: CB: Disconnected %u\n", peer_id); |
46 | if(0 == cb_call) | 46 | if(0 == cb_call) |
47 | { | 47 | { |
48 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: and it shouldn't!\n"); | 48 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: and it shouldn't!\n"); |
@@ -181,7 +181,7 @@ main (int argc, char *argv[]) | |||
181 | path->length = 4; | 181 | path->length = 4; |
182 | 182 | ||
183 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 1 2 3 4\n"); | 183 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 1 2 3 4\n"); |
184 | tree_add_path(tree, path, &cb); | 184 | tree_add_path(tree, path, &cb, NULL); |
185 | tree_debug(tree); | 185 | tree_debug(tree); |
186 | path1 = tree_get_path_to_peer(tree, 4); | 186 | path1 = tree_get_path_to_peer(tree, 4); |
187 | if (path->length != path1->length || | 187 | if (path->length != path1->length || |
@@ -198,7 +198,7 @@ main (int argc, char *argv[]) | |||
198 | 198 | ||
199 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding second path: 1 2 3\n"); | 199 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding second path: 1 2 3\n"); |
200 | path->length--; | 200 | path->length--; |
201 | tree_add_path(tree, path, &cb); | 201 | tree_add_path(tree, path, &cb, NULL); |
202 | tree_debug(tree); | 202 | tree_debug(tree); |
203 | 203 | ||
204 | test_assert (4, MESH_PEER_SEARCHING, 0, 2); | 204 | test_assert (4, MESH_PEER_SEARCHING, 0, 2); |
@@ -209,7 +209,7 @@ main (int argc, char *argv[]) | |||
209 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n"); | 209 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n"); |
210 | path->length++; | 210 | path->length++; |
211 | path->peers[3] = 5; | 211 | path->peers[3] = 5; |
212 | tree_add_path(tree, path, &cb); | 212 | tree_add_path(tree, path, &cb, NULL); |
213 | tree_debug(tree); | 213 | tree_debug(tree); |
214 | 214 | ||
215 | test_assert (5, MESH_PEER_SEARCHING, 0, 2); | 215 | test_assert (5, MESH_PEER_SEARCHING, 0, 2); |
@@ -222,7 +222,7 @@ main (int argc, char *argv[]) | |||
222 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path...\n"); | 222 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path...\n"); |
223 | node->status = MESH_PEER_READY; | 223 | node->status = MESH_PEER_READY; |
224 | cb_call = 1; | 224 | cb_call = 1; |
225 | node2 = tree_del_path(tree, 5, &cb); | 225 | node2 = tree_del_path(tree, 5, &cb, NULL); |
226 | tree_debug(tree); | 226 | tree_debug(tree); |
227 | if (cb_call != 0) | 227 | if (cb_call != 0) |
228 | { | 228 | { |
@@ -249,7 +249,7 @@ main (int argc, char *argv[]) | |||
249 | path->peers[1] = 4; | 249 | path->peers[1] = 4; |
250 | cb_call = 1; | 250 | cb_call = 1; |
251 | tree_find_peer(tree->root, 4)->status = MESH_PEER_READY; | 251 | tree_find_peer(tree->root, 4)->status = MESH_PEER_READY; |
252 | tree_add_path(tree, path, cb); | 252 | tree_add_path(tree, path, &cb, NULL); |
253 | tree_debug(tree); | 253 | tree_debug(tree); |
254 | if (cb_call != 0) | 254 | if (cb_call != 0) |
255 | { | 255 | { |
@@ -287,7 +287,7 @@ main (int argc, char *argv[]) | |||
287 | path->length = 3; | 287 | path->length = 3; |
288 | 288 | ||
289 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 1 2 3\n"); | 289 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding first path: 1 2 3\n"); |
290 | tree_add_path(tree, path, &cb); | 290 | tree_add_path(tree, path, &cb, NULL); |
291 | tree_debug(tree); | 291 | tree_debug(tree); |
292 | tree->me = tree_find_peer (tree->root, 2); | 292 | tree->me = tree_find_peer (tree->root, 2); |
293 | 293 | ||
@@ -296,7 +296,7 @@ main (int argc, char *argv[]) | |||
296 | test_assert (1, MESH_PEER_ROOT, 1, 0); | 296 | test_assert (1, MESH_PEER_ROOT, 1, 0); |
297 | 297 | ||
298 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding same path: 1 2 3\n"); | 298 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding same path: 1 2 3\n"); |
299 | tree_add_path(tree, path, &cb); | 299 | tree_add_path(tree, path, &cb, NULL); |
300 | 300 | ||
301 | GNUNET_free (path->peers); | 301 | GNUNET_free (path->peers); |
302 | GNUNET_free (path); | 302 | GNUNET_free (path); |