diff options
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 44 | ||||
-rw-r--r-- | src/mesh/mesh_tunnel_tree.c | 2 | ||||
-rw-r--r-- | src/mesh/test_mesh_2dtorus.c | 58 | ||||
-rw-r--r-- | src/mesh/test_mesh_small.c | 2 | ||||
-rw-r--r-- | src/mesh/test_mesh_small_unicast_far.c | 2 | ||||
-rw-r--r-- | src/mesh/test_mesh_tree_api.c | 39 |
6 files changed, 58 insertions, 89 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 8883602ab6..564640acdd 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -1461,7 +1461,8 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1, for (i = 0; i < peer->ntunnels; i++) { d = tunnel_notify_connection_broken (peer->tunnels[i], p1, p2); - if (0 == d) continue; + if (0 == d) + continue; /* TODO * Problem: one or more peers have been deleted from the tunnel tree. * We don't know who they are to try to add them again. @@ -1699,7 +1700,7 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path, /** * Adds a path to the peer_infos of all the peers in the path - * + * * @param p Path to process. * @param confirmed Whether we know if the path works or not. FIXME use */ @@ -1709,16 +1710,16 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed) unsigned int i; /* TODO: invert and add */ - for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */; + for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ; for (i++; i < p->length; i++) { struct MeshPeerInfo *aux; struct MeshPeerPath *copy; - aux = peer_info_get_short(p->peers[i]); - copy = path_duplicate(p); + aux = peer_info_get_short (p->peers[i]); + copy = path_duplicate (p); copy->length = i + 1; - peer_info_add_path(aux, copy, GNUNET_NO); + peer_info_add_path (aux, copy, GNUNET_NO); } } @@ -2063,14 +2064,12 @@ tunnel_send_multicast (struct MeshTunnel *t, mcast = (struct GNUNET_MESH_Multicast *) mdata->data; mcast->ttl = htonl (ntohl (mcast->ttl) - 1); #if MESH_DEBUG - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MESH: data packet, ttl: %u\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: data packet, ttl: %u\n", ntohl (mcast->ttl)); } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MESH: not a data packet, no ttl\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n"); #endif } if (NULL != t->client) @@ -2601,7 +2600,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, /* FIXME error. destroy tunnel? leave for timeout? */ return 0; } - path_add_to_peers(path, GNUNET_NO); + path_add_to_peers (path, GNUNET_NO); tunnel_add_path (t, path, own_pos); if (own_pos == size - 1) { @@ -2938,16 +2937,14 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, { /* FIXME: already seen this packet, log dropping */ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "MESH: Already seen mid %u, DROPPING!\n", - t->mid); + "MESH: Already seen mid %u, DROPPING!\n", t->mid); return GNUNET_OK; } #if MESH_DEBUG else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MESH: mid %u not seen yet, forwarding\n", - ntohl (msg->mid)); + "MESH: mid %u not seen yet, forwarding\n", ntohl (msg->mid)); } #endif t->mid = ntohl (msg->mid); @@ -2960,15 +2957,12 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, send_subscribed_clients (message, &msg[1].header); } #if MESH_DEBUG - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MESH: ttl: %u\n", - ntohl (msg->ttl)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: ttl: %u\n", ntohl (msg->ttl)); #endif if (ntohl (msg->ttl) == 0) { /* FIXME: ttl is 0, log dropping */ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "MESH: TTL is 0, DROPPING!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "MESH: TTL is 0, DROPPING!\n"); return GNUNET_OK; } tunnel_send_multicast (t, message); @@ -3097,11 +3091,11 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, peer_info = peer_info_get (&msg->peer_id); /* Add paths to peers? */ - p = tree_get_path_to_peer(t->tree, peer_info->id); + p = tree_get_path_to_peer (t->tree, peer_info->id); if (NULL != p) { path_add_to_peers (p, GNUNET_YES); - path_destroy(p); + path_destroy (p); } else { @@ -3122,7 +3116,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_DHT_get_stop (t->dht_get_type); t->dht_get_type = NULL; } - if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY) + if (tree_get_status (t->tree, peer_info->id) != MESH_PEER_READY) { tree_set_status (t->tree, peer_info->id, MESH_PEER_READY); send_client_peer_connected (t, peer_info->id); @@ -3308,7 +3302,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, p = path_build_from_dht (get_path, get_path_length, put_path, put_path_length); - path_add_to_peers(p, GNUNET_NO); + path_add_to_peers (p, GNUNET_NO); for (i = 0; i < path_info->peer->ntunnels; i++) { tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer); @@ -3362,7 +3356,7 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp, p = path_build_from_dht (get_path, get_path_length, put_path, put_path_length); - path_add_to_peers(p, GNUNET_NO); + path_add_to_peers (p, GNUNET_NO); tunnel_add_peer (t, peer_info); peer_info_connect (peer_info, t); } diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c index 7b04385bcd..a7577e36f8 100644 --- a/src/mesh/mesh_tunnel_tree.c +++ b/src/mesh/mesh_tunnel_tree.c @@ -992,7 +992,7 @@ tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer, * * @return Number of hops to reach destination, UINT_MAX in case the peer is not * in the path. - * + * * TODO: adapt to allow any start / root combination * TODO: take in account state of the nodes */ diff --git a/src/mesh/test_mesh_2dtorus.c b/src/mesh/test_mesh_2dtorus.c index 718ab0864c..6d91185cc5 100644 --- a/src/mesh/test_mesh_2dtorus.c +++ b/src/mesh/test_mesh_2dtorus.c @@ -104,8 +104,7 @@ shutdown_callback (void *cls, const char *emsg) if (emsg != NULL) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: Shutdown of peers failed! (%s)\n", - emsg); + "test: Shutdown of peers failed! (%s)\n", emsg); ok--; } #if VERBOSE @@ -122,8 +121,7 @@ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { #if VERBOSE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Ending test.\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n"); #endif GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); @@ -134,8 +132,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: disconnecting peers\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: disconnecting peers\n"); if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) { @@ -162,33 +159,26 @@ topo_cb (void *cls, const struct GNUNET_PeerIdentity *first, topo_connections++; if (NULL != emsg) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: Error by topo %u: %s\n", + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: Error by topo %u: %s\n", topo_connections, emsg); } else { if (first == NULL || second == NULL) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Connection %u NULL\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u NULL\n", topo_connections); if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (disconnect_task); - GNUNET_SCHEDULER_add_now(&disconnect_peers, NULL); + GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); } return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Connection %u ok\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Connection %u ok\n", topo_connections); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: %s\n", - GNUNET_i2s (first)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: %s\n", - GNUNET_i2s (second)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (first)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: %s\n", GNUNET_i2s (second)); } } @@ -205,8 +195,8 @@ peergroup_ready (void *cls, const char *emsg) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Peergroup callback called with error, aborting test!\n"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Error from testing: `%s'\n", emsg); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n", + emsg); ok--; GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); return; @@ -216,8 +206,7 @@ peergroup_ready (void *cls, const char *emsg) "************************************************************\n"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Peer Group started successfully!\n"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Have %u connections\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n", total_connections); #endif @@ -225,8 +214,7 @@ peergroup_ready (void *cls, const char *emsg) if (0 < failed_connections) { ok = GNUNET_SYSERR; - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "test: %u connections have FAILED!\n", + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "test: %u connections have FAILED!\n", failed_connections); disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); @@ -272,12 +260,9 @@ connect_cb (void *cls, const struct GNUNET_PeerIdentity *first, { failed_connections++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Problem with new connection (%s)\n", - emsg); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", - GNUNET_i2s (first)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", - GNUNET_i2s (second)); + "test: Problem with new connection (%s)\n", emsg); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (first)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: (%s)\n", GNUNET_i2s (second)); } } @@ -310,8 +295,7 @@ run (void *cls, char *const *args, const char *cfgfile, NULL); #if VERBOSE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "test: Starting daemons.\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n"); GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing", "use_progressbars", "YES"); #endif @@ -369,16 +353,14 @@ main (int argc, char *argv[]) GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, - "test_mesh_2dtorus", - gettext_noop ("Test mesh 2d torus."), options, - &run, NULL); + "test_mesh_2dtorus", gettext_noop ("Test mesh 2d torus."), + options, &run, NULL); #if REMOVE_DIR GNUNET_DISK_directory_remove ("/tmp/test_mesh_2dtorus"); #endif if (GNUNET_OK != ok) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: FAILED!\n"); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n"); return 1; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n"); diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index 5a83994f3b..f273b04abc 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c @@ -767,7 +767,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small", - "WAIT_TIME", &wait_time)) + "WAIT_TIME", &wait_time)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Option test_mesh_small:wait_time is required!\n"); diff --git a/src/mesh/test_mesh_small_unicast_far.c b/src/mesh/test_mesh_small_unicast_far.c index 1708e96cda..ed65da2e49 100644 --- a/src/mesh/test_mesh_small_unicast_far.c +++ b/src/mesh/test_mesh_small_unicast_far.c @@ -480,7 +480,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (testing_cfg, "test_mesh_small", - "WAIT_TIME", &wait_time)) + "WAIT_TIME", &wait_time)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Option test_mesh_small:wait_time is required!\n"); diff --git a/src/mesh/test_mesh_tree_api.c b/src/mesh/test_mesh_tree_api.c index ec92a5eced..60e31bddeb 100644 --- a/src/mesh/test_mesh_tree_api.c +++ b/src/mesh/test_mesh_tree_api.c @@ -78,16 +78,15 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status, if (n->peer != peer_id) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Retrieved peer has wrong ID! (Got %u, expected %u)\n", - n->peer, peer_id); + "Retrieved peer has wrong ID! (Got %u, expected %u)\n", n->peer, + peer_id); failed++; } if (n->status != status) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Retrieved peer has wrong status! (Got %u, expected %u)\n", - n->status, - status); + n->status, status); failed++; } for (c = n->children_head, i = 0; NULL != c; c = c->next, i++) ; @@ -101,7 +100,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status, if (0 != first_hop && GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)) != first_hop) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Wrong first hop! (Got %u, expected %u)\n", + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Wrong first hop! (Got %u, expected %u)\n", GNUNET_PEER_search (tree_get_first_hop (tree, peer_id)), first_hop); failed++; @@ -112,8 +112,8 @@ test_assert (GNUNET_PEER_Id peer_id, enum MeshPeerState status, GNUNET_PEER_resolve (peer_id, &id); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "*** Peer %s (%u) has failed %d checks!\n", - GNUNET_i2s (&id), peer_id, failed - pre_failed); + "*** Peer %s (%u) has failed %d checks!\n", GNUNET_i2s (&id), + peer_id, failed - pre_failed); } } @@ -219,41 +219,34 @@ main (int argc, char *argv[]) for (i = 1; i < 5; i++) { path->length = i; - if (tree_get_path_cost(tree, path) != 0) + if (tree_get_path_cost (tree, path) != 0) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: length %u cost failed!\n", + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i); failed++; } } path->length++; path->peers[4] = 6; - if (tree_get_path_cost(tree, path) != 1) + if (tree_get_path_cost (tree, path) != 1) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: length %u cost failed!\n", - i); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i); failed++; } path->peers[3] = 7; - if (tree_get_path_cost(tree, path) != 2) + if (tree_get_path_cost (tree, path) != 2) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: length %u cost failed!\n", - i); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i); failed++; } path->length--; - if (tree_get_path_cost(tree, path) != 1) + if (tree_get_path_cost (tree, path) != 1) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "test: length %u cost failed!\n", - i); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: length %u cost failed!\n", i); failed++; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Deleting third path (5)\n"); - tree_set_status(tree, 5, MESH_PEER_READY); + tree_set_status (tree, 5, MESH_PEER_READY); cb_call = 1; node = tree_del_path (tree, 5, &cb, NULL); tree_debug (tree); |