- fix consensus profiler test (multiple channels reusing same tunnel/session)
authorBart Polot <bart@net.in.tum.de>
Wed, 27 Nov 2013 05:08:55 +0000 (05:08 +0000)
committerBart Polot <bart@net.in.tum.de>
Wed, 27 Nov 2013 05:08:55 +0000 (05:08 +0000)
src/mesh/gnunet-service-mesh_connection.c
src/mesh/gnunet-service-mesh_peer.c
src/mesh/gnunet-service-mesh_tunnel.c

index 35502f8c7d2621c4db532b933637494230076970..e33a9e23b3c19bbd33080b76e6bfa8e7d2150ec3 100644 (file)
@@ -2270,7 +2270,9 @@ GMC_get_id (const struct MeshConnection *c)
 const struct MeshPeerPath *
 GMC_get_path (const struct MeshConnection *c)
 {
-  return c->path;
+  if (GNUNET_NO == c->destroy)
+    return c->path;
+  return NULL;
 }
 
 
index 1679e2e667c8c93bcb1872080496db56f910a736..967bd1712b0fb88c6cf97a2bcaf6002412900970 100644 (file)
@@ -1336,6 +1336,11 @@ GMP_connect (struct MeshPeer *peer)
         return;
       }
     }
+    else
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "but is NULL!!\n");
+      GNUNET_break (0);
+    }
   }
 
   if (NULL != peer->search_h && GNUNET_YES == rerun_search)
index 0d589acf4b87485f71fa2aa9106765defd30741a..eaf21dbf0d51d3ab5a5ea6172b6badb5f61ab747 100644 (file)
@@ -1642,6 +1642,12 @@ GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
   aux->ch = ch;
   LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head);
   GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux);
+
+  if (GNUNET_YES == t->destroy)
+  {
+    t->destroy = GNUNET_NO;
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " undo destroy!\n");
+  }
 }
 
 
@@ -2274,6 +2280,7 @@ GMT_get_path_cost (const struct MeshTunnel3 *t,
                    const struct MeshPeerPath *path)
 {
   struct MeshTConnection *iter;
+  const struct MeshPeerPath *aux;
   unsigned int overlap;
   unsigned int i;
   unsigned int j;
@@ -2288,9 +2295,13 @@ GMT_get_path_cost (const struct MeshTunnel3 *t,
   {
     for (iter = t->connection_head; NULL != iter; iter = iter->next)
     {
-      for (j = 0; j < GMC_get_path (iter->c)->length; j++)
+      aux = GMC_get_path (iter->c);
+      if (NULL == aux)
+        continue;
+
+      for (j = 0; j < aux->length; j++)
       {
-        if (path->peers[i] == GMC_get_path (iter->c)->peers[j])
+        if (path->peers[i] == aux->peers[j])
         {
           overlap++;
           break;