diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-01-16 12:12:12 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-01-16 12:12:12 +0000 |
commit | 42020e0cd21d9999ec08073fe44de7105cbd931f (patch) | |
tree | 21da63317e4a98b4c61694d02b1f01192313149a /src/mesh/gnunet-service-mesh_tunnel.c | |
parent | 60b54dd576f6d523b7e1c4d9a20910fb8adce409 (diff) | |
download | gnunet-42020e0cd21d9999ec08073fe44de7105cbd931f.tar.gz gnunet-42020e0cd21d9999ec08073fe44de7105cbd931f.zip |
-when tunnel is empty
-- don't end connections
-- don't stop encryption handshake
Diffstat (limited to 'src/mesh/gnunet-service-mesh_tunnel.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 110c6d07e..ed556c811 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1995,9 +1995,15 @@ static void | |||
1995 | delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1995 | delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1996 | { | 1996 | { |
1997 | struct MeshTunnel3 *t = cls; | 1997 | struct MeshTunnel3 *t = cls; |
1998 | struct MeshTConnection *iter; | ||
1998 | 1999 | ||
1999 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; | 2000 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; |
2000 | t->cstate = MESH_TUNNEL3_SHUTDOWN; | 2001 | t->cstate = MESH_TUNNEL3_SHUTDOWN; |
2002 | |||
2003 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | ||
2004 | { | ||
2005 | GMC_send_destroy (iter->c); | ||
2006 | } | ||
2001 | GMT_destroy (t); | 2007 | GMT_destroy (t); |
2002 | } | 2008 | } |
2003 | 2009 | ||
@@ -2012,24 +2018,9 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2012 | void | 2018 | void |
2013 | GMT_destroy_empty (struct MeshTunnel3 *t) | 2019 | GMT_destroy_empty (struct MeshTunnel3 *t) |
2014 | { | 2020 | { |
2015 | struct MeshTConnection *iter; | ||
2016 | |||
2017 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", | 2021 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", |
2018 | GMT_2s (t)); | 2022 | GMT_2s (t)); |
2019 | for (iter = t->connection_head; NULL != iter; iter = iter->next) | ||
2020 | { | ||
2021 | GMC_send_destroy (iter->c); | ||
2022 | } | ||
2023 | 2023 | ||
2024 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) | ||
2025 | { | ||
2026 | t->estate = MESH_TUNNEL3_KEY_UNINITIALIZED; | ||
2027 | GNUNET_SCHEDULER_cancel (t->rekey_task); | ||
2028 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; | ||
2029 | GNUNET_free (t->kx_ctx); | ||
2030 | t->kx_ctx = NULL; | ||
2031 | } | ||
2032 | t->cstate = MESH_TUNNEL3_NEW; | ||
2033 | t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 2024 | t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
2034 | &delayed_destroy, t); | 2025 | &delayed_destroy, t); |
2035 | } | 2026 | } |
@@ -2100,7 +2091,14 @@ GMT_destroy (struct MeshTunnel3 *t) | |||
2100 | GMP_set_tunnel (t->peer, NULL); | 2091 | GMP_set_tunnel (t->peer, NULL); |
2101 | 2092 | ||
2102 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) | 2093 | if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) |
2094 | { | ||
2103 | GNUNET_SCHEDULER_cancel (t->rekey_task); | 2095 | GNUNET_SCHEDULER_cancel (t->rekey_task); |
2096 | t->rekey_task = GNUNET_SCHEDULER_NO_TASK; | ||
2097 | if (NULL != t->kx_ctx) | ||
2098 | GNUNET_free (t->kx_ctx); | ||
2099 | else | ||
2100 | GNUNET_break (0); | ||
2101 | } | ||
2104 | 2102 | ||
2105 | GNUNET_free (t); | 2103 | GNUNET_free (t); |
2106 | } | 2104 | } |