From 0f67fd7bc65b07feceff790fb18e7e8a0aaeac69 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 24 Feb 2017 13:25:56 +0100 Subject: [PATCH] update counters properly --- src/cadet/gnunet-service-cadet-new_tunnels.c | 7 +++++++ .../gnunet-service-transport_neighbours.c | 17 +++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index af77ea067..05a1e071d 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c @@ -603,6 +603,7 @@ GCT_count_any_connections (const struct CadetTunnel *t) static struct CadetTConnection * get_ready_connection (struct CadetTunnel *t) { + GNUNET_assert (GNUNET_YES == t->connection_ready_head->is_ready); return t->connection_ready_head; } @@ -1971,13 +1972,19 @@ GCT_connection_lost (struct CadetTConnection *ct) struct CadetTunnel *t = ct->t; if (GNUNET_YES == ct->is_ready) + { GNUNET_CONTAINER_DLL_remove (t->connection_ready_head, t->connection_ready_tail, ct); + t->num_ready_connections--; + } else + { GNUNET_CONTAINER_DLL_remove (t->connection_busy_head, t->connection_busy_tail, ct); + t->num_busy_connections--; + } GNUNET_free (ct); } diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 3952a728e..bbda715a2 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -1150,17 +1150,18 @@ set_incoming_quota (struct NeighbourMapEntry *n, sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage)); sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA); sqm.quota = quota.value__; - (void) send_with_session (n, - &sqm, - sizeof (sqm), - UINT32_MAX - 1, - GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_NO, - NULL, NULL); + if (NULL != n->primary_address.session) + (void) send_with_session (n, + &sqm, + sizeof (sqm), + UINT32_MAX - 1, + GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_NO, + NULL, NULL); return; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Disconnecting peer `%4s' due to SET_QUOTA\n", + "Disconnecting peer `%s' due to SET_QUOTA\n", GNUNET_i2s (&n->id)); if (GNUNET_YES == test_connected (n)) GNUNET_STATISTICS_update (GST_stats, -- 2.25.1