diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/mesh_tunnel_tree.c | 22 | ||||
-rw-r--r-- | src/mesh/mesh_tunnel_tree.h | 6 | ||||
-rw-r--r-- | src/mesh/test_mesh_path_api.c | 7 |
3 files changed, 31 insertions, 4 deletions
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c index 929b1b69b..747789096 100644 --- a/src/mesh/mesh_tunnel_tree.c +++ b/src/mesh/mesh_tunnel_tree.c | |||
@@ -28,6 +28,28 @@ | |||
28 | #include "mesh_tunnel_tree.h" | 28 | #include "mesh_tunnel_tree.h" |
29 | 29 | ||
30 | 30 | ||
31 | static void | ||
32 | debug_node(struct MeshTunnelTreeNode *n, uint16_t level) | ||
33 | { | ||
34 | uint16_t i; | ||
35 | |||
36 | for (i = 0; i < level; i++) | ||
37 | fprintf(stderr, " "); | ||
38 | fprintf(stderr, "%u\n", n->peer); | ||
39 | for (i = 0; i < n->nchildren; i++) | ||
40 | debug_node(&n->children[i], level + 1); | ||
41 | } | ||
42 | |||
43 | |||
44 | |||
45 | void | ||
46 | tree_debug(struct MeshTunnelTree *t) | ||
47 | { | ||
48 | debug_node(t->root, 0); | ||
49 | } | ||
50 | |||
51 | |||
52 | |||
31 | /** | 53 | /** |
32 | * Invert the path | 54 | * Invert the path |
33 | * | 55 | * |
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h index 401ebb089..6573a85bd 100644 --- a/src/mesh/mesh_tunnel_tree.h +++ b/src/mesh/mesh_tunnel_tree.h | |||
@@ -271,4 +271,8 @@ tree_node_destroy (struct MeshTunnelTreeNode *n); | |||
271 | * @param t Tree to be destroyed | 271 | * @param t Tree to be destroyed |
272 | */ | 272 | */ |
273 | void | 273 | void |
274 | tree_destroy (struct MeshTunnelTree *t); \ No newline at end of file | 274 | tree_destroy (struct MeshTunnelTree *t); |
275 | |||
276 | |||
277 | void | ||
278 | tree_debug(struct MeshTunnelTree *t); \ No newline at end of file | ||
diff --git a/src/mesh/test_mesh_path_api.c b/src/mesh/test_mesh_path_api.c index 36eace93d..3d6a06857 100644 --- a/src/mesh/test_mesh_path_api.c +++ b/src/mesh/test_mesh_path_api.c | |||
@@ -233,15 +233,16 @@ main (int argc, char *argv[]) | |||
233 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n"); | 233 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Retrieved peer wrong nchildren!\n"); |
234 | failed++; | 234 | failed++; |
235 | } | 235 | } |
236 | path->length++; | ||
237 | path_destroy(path); | ||
238 | finish(); | ||
239 | 236 | ||
240 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n"); | 237 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "test: Adding third path...\n"); |
241 | path->length++; | 238 | path->length++; |
242 | path->peers[3] = 4; | 239 | path->peers[3] = 4; |
243 | tree_add_path(tree, path, &cb); | 240 | tree_add_path(tree, path, &cb); |
244 | 241 | ||
242 | path_destroy(path); | ||
243 | tree_debug(tree); | ||
244 | finish(); | ||
245 | |||
245 | node = tree_find_peer(tree->root, 2); | 246 | node = tree_find_peer(tree->root, 2); |
246 | if (node->peer != 2) | 247 | if (node->peer != 2) |
247 | { | 248 | { |