diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-01-16 11:54:05 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-01-16 11:54:05 +0000 |
commit | 60b54dd576f6d523b7e1c4d9a20910fb8adce409 (patch) | |
tree | ecd594f18ae601028c54cd5a787678b24c6c5201 /src/mesh/gnunet-service-mesh_tunnel.c | |
parent | 9055d1dbba8d1e6e0e1de69c9cca8e9265c4eb4c (diff) | |
download | gnunet-60b54dd576f6d523b7e1c4d9a20910fb8adce409.tar.gz gnunet-60b54dd576f6d523b7e1c4d9a20910fb8adce409.zip |
- add explicit shutdown state
- don't try to reconnect when destroying last connection during tunnel_destroy
- don't create new connections for a tunnel in shutdown
Diffstat (limited to 'src/mesh/gnunet-service-mesh_tunnel.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 7b51106af..110c6d07e 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -1872,6 +1872,7 @@ GMT_remove_connection (struct MeshTunnel3 *t, | |||
1872 | /* Start new connections if needed */ | 1872 | /* Start new connections if needed */ |
1873 | if (NULL == t->connection_head | 1873 | if (NULL == t->connection_head |
1874 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task | 1874 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task |
1875 | && MESH_TUNNEL3_SHUTDOWN != t->cstate | ||
1875 | && GNUNET_NO == shutting_down) | 1876 | && GNUNET_NO == shutting_down) |
1876 | { | 1877 | { |
1877 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); | 1878 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); |
@@ -1996,6 +1997,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1996 | struct MeshTunnel3 *t = cls; | 1997 | struct MeshTunnel3 *t = cls; |
1997 | 1998 | ||
1998 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; | 1999 | t->destroy_task = GNUNET_SCHEDULER_NO_TASK; |
2000 | t->cstate = MESH_TUNNEL3_SHUTDOWN; | ||
1999 | GMT_destroy (t); | 2001 | GMT_destroy (t); |
2000 | } | 2002 | } |
2001 | 2003 | ||
@@ -2127,6 +2129,12 @@ GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p) | |||
2127 | return NULL; | 2129 | return NULL; |
2128 | } | 2130 | } |
2129 | 2131 | ||
2132 | if (MESH_TUNNEL3_SHUTDOWN == t->cstate) | ||
2133 | { | ||
2134 | GNUNET_break (0); | ||
2135 | return NULL; | ||
2136 | } | ||
2137 | |||
2130 | for (own_pos = 0; own_pos < p->length; own_pos++) | 2138 | for (own_pos = 0; own_pos < p->length; own_pos++) |
2131 | { | 2139 | { |
2132 | if (p->peers[own_pos] == myid) | 2140 | if (p->peers[own_pos] == myid) |