aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 8883602ab..564640acd 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,
1461 for (i = 0; i < peer->ntunnels; i++) 1461 for (i = 0; i < peer->ntunnels; i++)
1462 { 1462 {
1463 d = tunnel_notify_connection_broken (peer->tunnels[i], p1, p2); 1463 d = tunnel_notify_connection_broken (peer->tunnels[i], p1, p2);
1464 if (0 == d) continue; 1464 if (0 == d)
1465 continue;
1465 /* TODO 1466 /* TODO
1466 * Problem: one or more peers have been deleted from the tunnel tree. 1467 * Problem: one or more peers have been deleted from the tunnel tree.
1467 * We don't know who they are to try to add them again. 1468 * 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,
1699 1700
1700/** 1701/**
1701 * Adds a path to the peer_infos of all the peers in the path 1702 * Adds a path to the peer_infos of all the peers in the path
1702 * 1703 *
1703 * @param p Path to process. 1704 * @param p Path to process.
1704 * @param confirmed Whether we know if the path works or not. FIXME use 1705 * @param confirmed Whether we know if the path works or not. FIXME use
1705 */ 1706 */
@@ -1709,16 +1710,16 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed)
1709 unsigned int i; 1710 unsigned int i;
1710 1711
1711 /* TODO: invert and add */ 1712 /* TODO: invert and add */
1712 for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */; 1713 for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
1713 for (i++; i < p->length; i++) 1714 for (i++; i < p->length; i++)
1714 { 1715 {
1715 struct MeshPeerInfo *aux; 1716 struct MeshPeerInfo *aux;
1716 struct MeshPeerPath *copy; 1717 struct MeshPeerPath *copy;
1717 1718
1718 aux = peer_info_get_short(p->peers[i]); 1719 aux = peer_info_get_short (p->peers[i]);
1719 copy = path_duplicate(p); 1720 copy = path_duplicate (p);
1720 copy->length = i + 1; 1721 copy->length = i + 1;
1721 peer_info_add_path(aux, copy, GNUNET_NO); 1722 peer_info_add_path (aux, copy, GNUNET_NO);
1722 } 1723 }
1723} 1724}
1724 1725
@@ -2063,14 +2064,12 @@ tunnel_send_multicast (struct MeshTunnel *t,
2063 mcast = (struct GNUNET_MESH_Multicast *) mdata->data; 2064 mcast = (struct GNUNET_MESH_Multicast *) mdata->data;
2064 mcast->ttl = htonl (ntohl (mcast->ttl) - 1); 2065 mcast->ttl = htonl (ntohl (mcast->ttl) - 1);
2065#if MESH_DEBUG 2066#if MESH_DEBUG
2066 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2067 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: data packet, ttl: %u\n",
2067 "MESH: data packet, ttl: %u\n",
2068 ntohl (mcast->ttl)); 2068 ntohl (mcast->ttl));
2069 } 2069 }
2070 else 2070 else
2071 { 2071 {
2072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: not a data packet, no ttl\n");
2073 "MESH: not a data packet, no ttl\n");
2074#endif 2073#endif
2075 } 2074 }
2076 if (NULL != t->client) 2075 if (NULL != t->client)
@@ -2601,7 +2600,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2601 /* FIXME error. destroy tunnel? leave for timeout? */ 2600 /* FIXME error. destroy tunnel? leave for timeout? */
2602 return 0; 2601 return 0;
2603 } 2602 }
2604 path_add_to_peers(path, GNUNET_NO); 2603 path_add_to_peers (path, GNUNET_NO);
2605 tunnel_add_path (t, path, own_pos); 2604 tunnel_add_path (t, path, own_pos);
2606 if (own_pos == size - 1) 2605 if (own_pos == size - 1)
2607 { 2606 {
@@ -2938,16 +2937,14 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2938 { 2937 {
2939 /* FIXME: already seen this packet, log dropping */ 2938 /* FIXME: already seen this packet, log dropping */
2940 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2939 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2941 "MESH: Already seen mid %u, DROPPING!\n", 2940 "MESH: Already seen mid %u, DROPPING!\n", t->mid);
2942 t->mid);
2943 return GNUNET_OK; 2941 return GNUNET_OK;
2944 } 2942 }
2945#if MESH_DEBUG 2943#if MESH_DEBUG
2946 else 2944 else
2947 { 2945 {
2948 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2946 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2949 "MESH: mid %u not seen yet, forwarding\n", 2947 "MESH: mid %u not seen yet, forwarding\n", ntohl (msg->mid));
2950 ntohl (msg->mid));
2951 } 2948 }
2952#endif 2949#endif
2953 t->mid = ntohl (msg->mid); 2950 t->mid = ntohl (msg->mid);
@@ -2960,15 +2957,12 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
2960 send_subscribed_clients (message, &msg[1].header); 2957 send_subscribed_clients (message, &msg[1].header);
2961 } 2958 }
2962#if MESH_DEBUG 2959#if MESH_DEBUG
2963 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2960 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: ttl: %u\n", ntohl (msg->ttl));
2964 "MESH: ttl: %u\n",
2965 ntohl (msg->ttl));
2966#endif 2961#endif
2967 if (ntohl (msg->ttl) == 0) 2962 if (ntohl (msg->ttl) == 0)
2968 { 2963 {
2969 /* FIXME: ttl is 0, log dropping */ 2964 /* FIXME: ttl is 0, log dropping */
2970 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2965 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "MESH: TTL is 0, DROPPING!\n");
2971 "MESH: TTL is 0, DROPPING!\n");
2972 return GNUNET_OK; 2966 return GNUNET_OK;
2973 } 2967 }
2974 tunnel_send_multicast (t, message); 2968 tunnel_send_multicast (t, message);
@@ -3097,11 +3091,11 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3097 peer_info = peer_info_get (&msg->peer_id); 3091 peer_info = peer_info_get (&msg->peer_id);
3098 3092
3099 /* Add paths to peers? */ 3093 /* Add paths to peers? */
3100 p = tree_get_path_to_peer(t->tree, peer_info->id); 3094 p = tree_get_path_to_peer (t->tree, peer_info->id);
3101 if (NULL != p) 3095 if (NULL != p)
3102 { 3096 {
3103 path_add_to_peers (p, GNUNET_YES); 3097 path_add_to_peers (p, GNUNET_YES);
3104 path_destroy(p); 3098 path_destroy (p);
3105 } 3099 }
3106 else 3100 else
3107 { 3101 {
@@ -3122,7 +3116,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3122 GNUNET_DHT_get_stop (t->dht_get_type); 3116 GNUNET_DHT_get_stop (t->dht_get_type);
3123 t->dht_get_type = NULL; 3117 t->dht_get_type = NULL;
3124 } 3118 }
3125 if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY) 3119 if (tree_get_status (t->tree, peer_info->id) != MESH_PEER_READY)
3126 { 3120 {
3127 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY); 3121 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);
3128 send_client_peer_connected (t, peer_info->id); 3122 send_client_peer_connected (t, peer_info->id);
@@ -3308,7 +3302,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
3308 3302
3309 p = path_build_from_dht (get_path, get_path_length, put_path, 3303 p = path_build_from_dht (get_path, get_path_length, put_path,
3310 put_path_length); 3304 put_path_length);
3311 path_add_to_peers(p, GNUNET_NO); 3305 path_add_to_peers (p, GNUNET_NO);
3312 for (i = 0; i < path_info->peer->ntunnels; i++) 3306 for (i = 0; i < path_info->peer->ntunnels; i++)
3313 { 3307 {
3314 tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer); 3308 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,
3362 3356
3363 p = path_build_from_dht (get_path, get_path_length, put_path, 3357 p = path_build_from_dht (get_path, get_path_length, put_path,
3364 put_path_length); 3358 put_path_length);
3365 path_add_to_peers(p, GNUNET_NO); 3359 path_add_to_peers (p, GNUNET_NO);
3366 tunnel_add_peer (t, peer_info); 3360 tunnel_add_peer (t, peer_info);
3367 peer_info_connect (peer_info, t); 3361 peer_info_connect (peer_info, t);
3368} 3362}