From 40537b04870c1fb34a231f85666ca39a6e4a6cbe Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 21 Feb 2017 13:48:00 +0100 Subject: [PATCH] Fix channel disconnect checking< --- src/cadet/test_cadet_new.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/cadet/test_cadet_new.c b/src/cadet/test_cadet_new.c index 622e87ea1..d32404815 100644 --- a/src/cadet/test_cadet_new.c +++ b/src/cadet/test_cadet_new.c @@ -729,33 +729,32 @@ connect_handler (void *cls, struct GNUNET_CADET_Channel *channel, * It should clean up any associated state, including cancelling any pending * transmission on this channel. * - * @param cls Channel closure. + * @param cls Channel closure (channel wrapper). * @param channel Connection to the other end (henceforth invalid). */ static void disconnect_handler (void *cls, const struct GNUNET_CADET_Channel *channel) { - long i = (long) cls; + struct CadetTestChannelWrapper *ch_w = cls; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Channel disconnected at %p\n", cls); - if (peers_running - 1 == i) + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Channel disconnected\n"); + GNUNET_assert (ch_w->ch == channel); + if (channel == incoming_ch) { ok++; - GNUNET_break (channel == incoming_ch); incoming_ch = NULL; } - else if (0L == i) + else if (outgoing_ch == channel + ) { if (P2P_SIGNAL == test) { ok++; } - GNUNET_break (channel == outgoing_ch); outgoing_ch = NULL; } else - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unknown peer! %d\n", (int) i); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unknown channel! %p\n", channel); GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); if (NULL != disconnect_task) -- 2.25.1