aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-04-09 10:56:47 +0000
committerBart Polot <bart@net.in.tum.de>2014-04-09 10:56:47 +0000
commite7481f4a59c04cddb4fd3c0d97e5d710758074dd (patch)
treee1f366994f61be4cebc6ee96e1ed23078224fc07
parent7f2cfd26a9e71bf1eccb8fa373776a6dfddc4352 (diff)
downloadgnunet-e7481f4a59c04cddb4fd3c0d97e5d710758074dd.tar.gz
gnunet-e7481f4a59c04cddb4fd3c0d97e5d710758074dd.zip
- always check if channel was last, then mark tunnel for destruction
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index cbf4887bd..3548ac6df 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -927,7 +927,7 @@ send_destroy (struct MeshChannel *ch, int local_only)
927 /* If root is not NULL, notify. 927 /* If root is not NULL, notify.
928 * If it's NULL, check lid_root. When a local destroy comes in, root 928 * If it's NULL, check lid_root. When a local destroy comes in, root
929 * is set to NULL but lid_root is left untouched. In this case, do nothing, 929 * is set to NULL but lid_root is left untouched. In this case, do nothing,
930 * the client is the one who reuqested the channel to be destroyed. 930 * the client is the one who requested the channel to be destroyed.
931 */ 931 */
932 if (NULL != ch->root) 932 if (NULL != ch->root)
933 GML_send_channel_destroy (ch->root, ch->lid_root); 933 GML_send_channel_destroy (ch->root, ch->lid_root);
@@ -1127,7 +1127,6 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time)
1127 { 1127 {
1128 struct MeshTunnel3 *t = rel->ch->t; 1128 struct MeshTunnel3 *t = rel->ch->t;
1129 GMCH_destroy (rel->ch); 1129 GMCH_destroy (rel->ch);
1130 GMT_destroy_if_empty (t);
1131 return GNUNET_YES; 1130 return GNUNET_YES;
1132 } 1131 }
1133 return GNUNET_NO; 1132 return GNUNET_NO;
@@ -1341,6 +1340,7 @@ void
1341GMCH_destroy (struct MeshChannel *ch) 1340GMCH_destroy (struct MeshChannel *ch)
1342{ 1341{
1343 struct MeshClient *c; 1342 struct MeshClient *c;
1343 struct MeshTunnel3 *t;
1344 1344
1345 if (NULL == ch) 1345 if (NULL == ch)
1346 return; 1346 return;
@@ -1367,10 +1367,12 @@ GMCH_destroy (struct MeshChannel *ch)
1367 channel_rel_free_all (ch->root_rel); 1367 channel_rel_free_all (ch->root_rel);
1368 channel_rel_free_all (ch->dest_rel); 1368 channel_rel_free_all (ch->dest_rel);
1369 1369
1370 GMT_remove_channel (ch->t, ch); 1370 t = ch->t;
1371 GMT_remove_channel (t, ch);
1371 GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO); 1372 GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO);
1372 1373
1373 GNUNET_free (ch); 1374 GNUNET_free (ch);
1375 GMT_destroy_if_empty (t);
1374} 1376}
1375 1377
1376 1378
@@ -1792,10 +1794,7 @@ GMCH_handle_local_destroy (struct MeshChannel *ch,
1792 t = ch->t; 1794 t = ch->t;
1793 send_destroy (ch, GNUNET_NO); 1795 send_destroy (ch, GNUNET_NO);
1794 if (0 == ch->pending_messages) 1796 if (0 == ch->pending_messages)
1795 {
1796 GMCH_destroy (ch); 1797 GMCH_destroy (ch);
1797 GMT_destroy_if_empty (t);
1798 }
1799} 1798}
1800 1799
1801 1800
@@ -2222,8 +2221,6 @@ GMCH_handle_destroy (struct MeshChannel *ch,
2222 const struct GNUNET_MESH_ChannelManage *msg, 2221 const struct GNUNET_MESH_ChannelManage *msg,
2223 int fwd) 2222 int fwd)
2224{ 2223{
2225 struct MeshTunnel3 *t;
2226
2227 /* If this is a remote (non-loopback) channel, find 'fwd'. */ 2224 /* If this is a remote (non-loopback) channel, find 'fwd'. */
2228 if (GNUNET_SYSERR == fwd) 2225 if (GNUNET_SYSERR == fwd)
2229 { 2226 {
@@ -2243,10 +2240,9 @@ GMCH_handle_destroy (struct MeshChannel *ch,
2243 return; 2240 return;
2244 } 2241 }
2245 2242
2246 t = ch->t; 2243
2247 send_destroy (ch, GNUNET_YES); 2244 send_destroy (ch, GNUNET_YES);
2248 GMCH_destroy (ch); 2245 GMCH_destroy (ch);
2249 GMT_destroy_if_empty (t);
2250} 2246}
2251 2247
2252 2248