[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30787 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30787 - gnunet/src/mesh |
Date: |
Mon, 18 Nov 2013 20:10:51 +0100 |
Author: bartpolot
Date: 2013-11-18 20:10:50 +0100 (Mon, 18 Nov 2013)
New Revision: 30787
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- destroy channels when tunnels is being destroyed (but complain: channels
should have been destroyed first). Probably wrong shutdown sequence.
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-18 19:00:43 UTC
(rev 30786)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-18 19:10:50 UTC
(rev 30787)
@@ -848,45 +848,6 @@
/**
- * Destroy a channel and free all resources.
- *
- * @param ch Channel to destroy.
- */
-static void
-channel_destroy (struct MeshChannel *ch)
-{
- struct MeshClient *c;
-
- if (NULL == ch)
- return;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n",
- GMT_2s (ch->t), ch->gid);
- GMCH_debug (ch);
-
- c = ch->root;
- if (NULL != c)
- {
- GML_channel_remove (c, ch->lid_root, ch);
- }
-
- c = ch->dest;
- if (NULL != c)
- {
- GML_channel_remove (c, ch->lid_dest, ch);
- }
-
- channel_rel_free_all (ch->root_rel);
- channel_rel_free_all (ch->dest_rel);
-
- GMT_remove_channel (ch->t, ch);
- GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO);
-
- GNUNET_free (ch);
-}
-
-
-/**
* Create a new channel.
*
* @param t Tunnel this channel is in.
@@ -1012,6 +973,53 @@
/**
+ * Destroy a channel and free all resources.
+ *
+ * @param ch Channel to destroy.
+ */
+void
+GMCH_destroy (struct MeshChannel *ch);
+
+/**
+ * Destroy a channel and free all resources.
+ *
+ * @param ch Channel to destroy.
+ */
+void
+GMCH_destroy (struct MeshChannel *ch)
+{
+ struct MeshClient *c;
+
+ if (NULL == ch)
+ return;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n",
+ GMT_2s (ch->t), ch->gid);
+ GMCH_debug (ch);
+
+ c = ch->root;
+ if (NULL != c)
+ {
+ GML_channel_remove (c, ch->lid_root, ch);
+ }
+
+ c = ch->dest;
+ if (NULL != c)
+ {
+ GML_channel_remove (c, ch->lid_dest, ch);
+ }
+
+ channel_rel_free_all (ch->root_rel);
+ channel_rel_free_all (ch->dest_rel);
+
+ GMT_remove_channel (ch->t, ch);
+ GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO);
+
+ GNUNET_free (ch);
+}
+
+
+/**
* Get channel ID.
*
* @param ch Channel.
@@ -1462,7 +1470,7 @@
t = ch->t;
GMCH_send_destroy (ch);
- channel_destroy (ch);
+ GMCH_destroy (ch);
GMT_destroy_if_empty (t);
}
@@ -1776,7 +1784,7 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " not loopback: destroy now\n");
channel_send_nack (ch);
- channel_destroy (ch);
+ GMCH_destroy (ch);
}
return NULL;
}
@@ -1809,7 +1817,7 @@
GMCH_handle_nack (struct MeshChannel *ch)
{
send_client_nack (ch);
- channel_destroy (ch);
+ GMCH_destroy (ch);
}
@@ -1882,7 +1890,7 @@
t = ch->t;
GMCH_send_destroy (ch);
- channel_destroy (ch);
+ GMCH_destroy (ch);
GMT_destroy_if_empty (t);
}
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-11-18 19:00:43 UTC
(rev 30786)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-11-18 19:10:50 UTC
(rev 30787)
@@ -1639,9 +1639,12 @@
void
GMT_destroy (struct MeshTunnel3 *t)
{
- struct MeshTConnection *iter;
- struct MeshTConnection *next;
+ struct MeshTConnection *iter_c;
+ struct MeshTConnection *next_c;
+ struct MeshTChannel *iter_ch;
+ struct MeshTChannel *next_ch;
+
if (NULL == t)
return;
@@ -1650,11 +1653,17 @@
// if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (tunnels, &t->id,
t))
// GNUNET_break (0);
- for (iter = t->connection_head; NULL != iter; iter = next)
+ for (iter_c = t->connection_head; NULL != iter_c; iter_c = next_c)
{
- next = iter->next;
- GMC_destroy (iter->c);
+ next_c = iter_c->next;
+ GMC_destroy (iter_c->c);
}
+ for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = next_ch)
+ {
+ next_ch = iter_ch->next;
+ GMCH_destroy (iter_ch->ch);
+ GNUNET_break (0);
+ }
GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO);
GMP_set_tunnel (t->peer, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30787 - gnunet/src/mesh,
gnunet <=