diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-07-28 05:12:38 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-07-28 05:12:38 +0000 |
commit | fc34de7eef58a5cf0f7df000eabb91d713dd86e4 (patch) | |
tree | 0281565a7c10efb4b2e774a31d8ca0e11e808c21 /src/cadet | |
parent | b63820a52b63d264bead047d0d6f4b76a94c4030 (diff) | |
download | gnunet-fc34de7eef58a5cf0f7df000eabb91d713dd86e4.tar.gz gnunet-fc34de7eef58a5cf0f7df000eabb91d713dd86e4.zip |
- set tunnel cstate to SEARCH when 0 connections are present
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 189c94ff8..0c797da5e 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -2371,6 +2371,7 @@ GCT_remove_connection (struct CadetTunnel *t, | |||
2371 | { | 2371 | { |
2372 | struct CadetTConnection *aux; | 2372 | struct CadetTConnection *aux; |
2373 | struct CadetTConnection *next; | 2373 | struct CadetTConnection *next; |
2374 | unsigned int conns; | ||
2374 | 2375 | ||
2375 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", | 2376 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", |
2376 | GCC_2s (c), GCT_2s (t)); | 2377 | GCC_2s (c), GCT_2s (t)); |
@@ -2384,14 +2385,18 @@ GCT_remove_connection (struct CadetTunnel *t, | |||
2384 | } | 2385 | } |
2385 | } | 2386 | } |
2386 | 2387 | ||
2388 | conns = GCT_count_connections (t); | ||
2389 | if (0 == conns) | ||
2390 | GCT_change_cstate (t, CADET_TUNNEL_SEARCHING); | ||
2391 | |||
2387 | /* Start new connections if needed */ | 2392 | /* Start new connections if needed */ |
2388 | if (CONNECTIONS_PER_TUNNEL > GCT_count_connections (t) | 2393 | if (CONNECTIONS_PER_TUNNEL > conns |
2389 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task | 2394 | && GNUNET_SCHEDULER_NO_TASK == t->destroy_task |
2390 | && CADET_TUNNEL_SHUTDOWN != t->cstate | 2395 | && CADET_TUNNEL_SHUTDOWN != t->cstate |
2391 | && GNUNET_NO == shutting_down) | 2396 | && GNUNET_NO == shutting_down) |
2392 | { | 2397 | { |
2393 | LOG (GNUNET_ERROR_TYPE_DEBUG, " too few connections, getting new ones\n"); | 2398 | LOG (GNUNET_ERROR_TYPE_DEBUG, " too few connections, getting new ones\n"); |
2394 | GCP_connect (t->peer); | 2399 | GCP_connect (t->peer); /* Will change cstate to WAITING when possible */ |
2395 | return; | 2400 | return; |
2396 | } | 2401 | } |
2397 | 2402 | ||
@@ -2403,8 +2408,6 @@ GCT_remove_connection (struct CadetTunnel *t, | |||
2403 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | 2408 | for (aux = t->connection_head; aux != NULL; aux = aux->next) |
2404 | if (CADET_CONNECTION_READY == GCC_get_state (aux->c)) | 2409 | if (CADET_CONNECTION_READY == GCC_get_state (aux->c)) |
2405 | return; | 2410 | return; |
2406 | |||
2407 | GCT_change_cstate (t, CADET_TUNNEL_WAITING); | ||
2408 | } | 2411 | } |
2409 | 2412 | ||
2410 | 2413 | ||