gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18191 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r18191 - gnunet/src/mesh
Date: Thu, 17 Nov 2011 16:46:48 +0100

Author: bartpolot
Date: 2011-11-17 16:46:48 +0100 (Thu, 17 Nov 2011)
New Revision: 18191

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh_tunnel_tree.c
Log:
Added code to avoid creashing on #1904 and identify the origin of the missing 
path

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-11-17 15:14:54 UTC (rev 
18190)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-11-17 15:46:48 UTC (rev 
18191)
@@ -3070,18 +3070,25 @@
   /* Add paths to peers */
   peer_info = peer_info_get (&msg->peer_id);
   p = tree_get_path_to_peer(t->tree, peer_info->id);
-  for (i = 1; i < p->length && p->peers[i] != myid; i++) /* skip'em */;
-  for (i++; i < p->length; i++)
+  if (NULL != p)
   {
-    struct MeshPeerInfo *aux;
-    struct MeshPeerPath *copy;
+    for (i = 1; 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);
-    copy->length = i;
-    peer_info_add_path(aux, copy, 0);
+      aux = peer_info_get_short(p->peers[i]);
+      copy = path_duplicate(p);
+      copy->length = i;
+      peer_info_add_path(aux, copy, 0);
+    }
+    path_destroy(p);
   }
-  path_destroy(p);
+  else
+  {
+    GNUNET_break (0);
+  }
 
   /* Message for us? */
   if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct 
GNUNET_PeerIdentity)))

Modified: gnunet/src/mesh/mesh_tunnel_tree.c
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.c  2011-11-17 15:14:54 UTC (rev 18190)
+++ gnunet/src/mesh/mesh_tunnel_tree.c  2011-11-17 15:46:48 UTC (rev 18191)
@@ -703,7 +703,10 @@
 
   n = tree_find_peer (t, peer);
   if (NULL == n)
+  {
+    GNUNET_break (0);
     return NULL;
+  }
   p = path_new (0);
 
   /* Building the path (inverted!) */
@@ -714,6 +717,7 @@
     n = n->parent;
     if (NULL == n)
     {
+      GNUNET_break (0);
       path_destroy (p);
       return NULL;
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]