From 90c8b6d3aee86a6ae12ad5ccf85e1de3769c86cc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 28 Feb 2015 13:21:05 +0000 Subject: adding additional checks for invariants to help find #3690 --- src/transport/gnunet-service-transport_neighbours.c | 12 ++++++++++++ src/transport/plugin_transport_http_client.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/transport') diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 7c596fbae..89a9a8b16 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -826,6 +826,9 @@ set_alternative_address (struct NeighbourMapEntry *n, n->alternative_address.session = session; n->alternative_address.ats_active = GNUNET_NO; n->alternative_address.keep_alive_nonce = 0; + GNUNET_assert (GNUNET_YES == + GST_ats_is_known (n->alternative_address.address, + n->alternative_address.session)); } @@ -890,6 +893,9 @@ set_primary_address (struct NeighbourMapEntry *n, n->primary_address.bandwidth_out = bandwidth_out; n->primary_address.session = session; n->primary_address.keep_alive_nonce = 0; + GNUNET_assert (GNUNET_YES == + GST_ats_is_known (n->primary_address.address, + n->primary_address.session)); /* subsystems about address use */ GST_validation_set_address_use (n->primary_address.address, GNUNET_YES); @@ -2455,6 +2461,9 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, /* switch to a different session, but keeping same address; could happen if there is a 2nd inbound connection */ n->primary_address.session = session; + GNUNET_assert (GNUNET_YES == + GST_ats_is_known (n->primary_address.address, + n->primary_address.session)); } n->primary_address.bandwidth_in = bandwidth_in; n->primary_address.bandwidth_out = bandwidth_out; @@ -3398,6 +3407,9 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, /* Destroy the inbound address since it cannot be used */ free_address (&n->primary_address); n->primary_address = n->alternative_address; + GNUNET_assert (GNUNET_YES == + GST_ats_is_known (n->primary_address.address, + n->primary_address.session)); memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 165045a8a..7d935b4f0 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -851,7 +851,7 @@ http_client_plugin_session_disconnect (void *cls, client_delete_session (s); /* Re-schedule since handles have changed */ - if (plugin->client_perform_task != NULL) + if (NULL != plugin->client_perform_task) { GNUNET_SCHEDULER_cancel (plugin->client_perform_task); plugin->client_perform_task = NULL; -- cgit v1.2.3