aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_tunnels.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_tunnels.c')
-rw-r--r--src/cadet/gnunet-service-cadet-new_tunnels.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c
index af77ea067..bf05fae6b 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -603,7 +603,11 @@ GCT_count_any_connections (const struct CadetTunnel *t)
603static struct CadetTConnection * 603static struct CadetTConnection *
604get_ready_connection (struct CadetTunnel *t) 604get_ready_connection (struct CadetTunnel *t)
605{ 605{
606 return t->connection_ready_head; 606 struct CadetTConnection *hd = t->connection_ready_head;
607
608 GNUNET_assert ( (NULL == hd) ||
609 (GNUNET_YES == hd->is_ready) );
610 return hd;
607} 611}
608 612
609 613
@@ -1315,7 +1319,8 @@ send_kx (struct CadetTunnel *t,
1315 struct GNUNET_CADET_TunnelKeyExchangeMessage *msg; 1319 struct GNUNET_CADET_TunnelKeyExchangeMessage *msg;
1316 enum GNUNET_CADET_KX_Flags flags; 1320 enum GNUNET_CADET_KX_Flags flags;
1317 1321
1318 if (NULL == ct) 1322 if ( (NULL == ct) ||
1323 (GNUNET_NO == ct->is_ready) )
1319 ct = get_ready_connection (t); 1324 ct = get_ready_connection (t);
1320 if (NULL == ct) 1325 if (NULL == ct)
1321 { 1326 {
@@ -1825,7 +1830,7 @@ GCT_handle_kx_auth (struct CadetTConnection *ct,
1825 1, 1830 1,
1826 GNUNET_NO); 1831 GNUNET_NO);
1827 send_kx (t, 1832 send_kx (t,
1828 NULL, 1833 ct,
1829 &t->ax); 1834 &t->ax);
1830 return; 1835 return;
1831 } 1836 }
@@ -1971,13 +1976,19 @@ GCT_connection_lost (struct CadetTConnection *ct)
1971 struct CadetTunnel *t = ct->t; 1976 struct CadetTunnel *t = ct->t;
1972 1977
1973 if (GNUNET_YES == ct->is_ready) 1978 if (GNUNET_YES == ct->is_ready)
1979 {
1974 GNUNET_CONTAINER_DLL_remove (t->connection_ready_head, 1980 GNUNET_CONTAINER_DLL_remove (t->connection_ready_head,
1975 t->connection_ready_tail, 1981 t->connection_ready_tail,
1976 ct); 1982 ct);
1983 t->num_ready_connections--;
1984 }
1977 else 1985 else
1986 {
1978 GNUNET_CONTAINER_DLL_remove (t->connection_busy_head, 1987 GNUNET_CONTAINER_DLL_remove (t->connection_busy_head,
1979 t->connection_busy_tail, 1988 t->connection_busy_tail,
1980 ct); 1989 ct);
1990 t->num_busy_connections--;
1991 }
1981 GNUNET_free (ct); 1992 GNUNET_free (ct);
1982} 1993}
1983 1994