aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-11-17 15:46:48 +0000
committerBart Polot <bart@net.in.tum.de>2011-11-17 15:46:48 +0000
commit875bd1aaf60122eeef188916c728b23ca86a9d83 (patch)
treee510ce29e5f2842156836a72d82d181b352e821f /src
parenta86115a483165228b5a92cd480864667780e4fa7 (diff)
downloadgnunet-875bd1aaf60122eeef188916c728b23ca86a9d83.tar.gz
gnunet-875bd1aaf60122eeef188916c728b23ca86a9d83.zip
Added code to avoid creashing on #1904 and identify the origin of the missing path
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c25
-rw-r--r--src/mesh/mesh_tunnel_tree.c4
2 files changed, 20 insertions, 9 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 786fa474f..79096447c 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -3070,18 +3070,25 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3070 /* Add paths to peers */ 3070 /* Add paths to peers */
3071 peer_info = peer_info_get (&msg->peer_id); 3071 peer_info = peer_info_get (&msg->peer_id);
3072 p = tree_get_path_to_peer(t->tree, peer_info->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 */; 3073 if (NULL != p)
3074 for (i++; i < p->length; i++)
3075 { 3074 {
3076 struct MeshPeerInfo *aux; 3075 for (i = 1; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
3077 struct MeshPeerPath *copy; 3076 for (i++; i < p->length; i++)
3077 {
3078 struct MeshPeerInfo *aux;
3079 struct MeshPeerPath *copy;
3078 3080
3079 aux = peer_info_get_short(p->peers[i]); 3081 aux = peer_info_get_short(p->peers[i]);
3080 copy = path_duplicate(p); 3082 copy = path_duplicate(p);
3081 copy->length = i; 3083 copy->length = i;
3082 peer_info_add_path(aux, copy, 0); 3084 peer_info_add_path(aux, copy, 0);
3085 }
3086 path_destroy(p);
3087 }
3088 else
3089 {
3090 GNUNET_break (0);
3083 } 3091 }
3084 path_destroy(p);
3085 3092
3086 /* Message for us? */ 3093 /* Message for us? */
3087 if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct GNUNET_PeerIdentity))) 3094 if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct GNUNET_PeerIdentity)))
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index 2b2e460b5..10d87cc42 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -703,7 +703,10 @@ tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
703 703
704 n = tree_find_peer (t, peer); 704 n = tree_find_peer (t, peer);
705 if (NULL == n) 705 if (NULL == n)
706 {
707 GNUNET_break (0);
706 return NULL; 708 return NULL;
709 }
707 p = path_new (0); 710 p = path_new (0);
708 711
709 /* Building the path (inverted!) */ 712 /* Building the path (inverted!) */
@@ -714,6 +717,7 @@ tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
714 n = n->parent; 717 n = n->parent;
715 if (NULL == n) 718 if (NULL == n)
716 { 719 {
720 GNUNET_break (0);
717 path_destroy (p); 721 path_destroy (p);
718 return NULL; 722 return NULL;
719 } 723 }