aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index bcf6a400b..e8b7ed7a0 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1521,6 +1521,12 @@ peer_info_add_path (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path,
1521 path_destroy (path); 1521 path_destroy (path);
1522 return; 1522 return;
1523 } 1523 }
1524 if (path->peers[path->length - 1] != peer_info->id)
1525 {
1526 GNUNET_break (0);
1527 path_destroy (path);
1528 return;
1529 }
1524 if (path->length <= 2 && GNUNET_NO == trusted) 1530 if (path->length <= 2 && GNUNET_NO == trusted)
1525 { 1531 {
1526 /* Only allow CORE to tell us about direct paths */ 1532 /* Only allow CORE to tell us about direct paths */
@@ -3047,7 +3053,9 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3047 struct GNUNET_MESH_PathACK *msg; 3053 struct GNUNET_MESH_PathACK *msg;
3048 struct GNUNET_PeerIdentity id; 3054 struct GNUNET_PeerIdentity id;
3049 struct MeshPeerInfo *peer_info; 3055 struct MeshPeerInfo *peer_info;
3056 struct MeshPeerPath *p;
3050 struct MeshTunnel *t; 3057 struct MeshTunnel *t;
3058 unsigned int i;
3051 3059
3052 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Received a path ACK msg [%s]\n", 3060 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Received a path ACK msg [%s]\n",
3053 GNUNET_i2s (&my_full_id)); 3061 GNUNET_i2s (&my_full_id));
@@ -3059,6 +3067,21 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3059 return GNUNET_OK; 3067 return GNUNET_OK;
3060 } 3068 }
3061 3069
3070 /* Add paths to peers */
3071 peer_info = peer_info_get (&msg->peer_id);
3072 p = tree_get_path_to_peer(t->tree, peer_info->id);
3073 for (i = 1; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
3074 for (i++; i < p->length; i++)
3075 {
3076 struct MeshPeerInfo *aux;
3077 struct MeshPeerPath *copy;
3078
3079 aux = peer_info_get_short(p->peers[i]);
3080 copy = path_duplicate(p);
3081 copy->length = i;
3082 peer_info_add_path(aux, copy, 0);
3083 }
3084
3062 /* Message for us? */ 3085 /* Message for us? */
3063 if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct GNUNET_PeerIdentity))) 3086 if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct GNUNET_PeerIdentity)))
3064 { 3087 {
@@ -3073,7 +3096,6 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3073 GNUNET_DHT_get_stop (t->dht_get_type); 3096 GNUNET_DHT_get_stop (t->dht_get_type);
3074 t->dht_get_type = NULL; 3097 t->dht_get_type = NULL;
3075 } 3098 }
3076 peer_info = peer_info_get (&msg->peer_id);
3077 if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY) 3099 if (tree_get_status(t->tree, peer_info->id) != MESH_PEER_READY)
3078 { 3100 {
3079 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY); 3101 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);