diff options
author | Bart Polot <bart.polot+gnunet@gmail.com> | 2017-02-21 13:48:00 +0100 |
---|---|---|
committer | Bart Polot <bart.polot+gnunet@gmail.com> | 2017-02-21 13:48:00 +0100 |
commit | 40537b04870c1fb34a231f85666ca39a6e4a6cbe (patch) | |
tree | 166a1d8ff49c34c66d072d3a9cc86b9be5bdfbbd /src | |
parent | e719c7792bab52ec9bb22ab8ed5ce6951f329404 (diff) | |
download | gnunet-40537b04870c1fb34a231f85666ca39a6e4a6cbe.tar.gz gnunet-40537b04870c1fb34a231f85666ca39a6e4a6cbe.zip |
Fix channel disconnect checking<
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/test_cadet_new.c | 17 |
1 files 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, | |||
729 | * It should clean up any associated state, including cancelling any pending | 729 | * It should clean up any associated state, including cancelling any pending |
730 | * transmission on this channel. | 730 | * transmission on this channel. |
731 | * | 731 | * |
732 | * @param cls Channel closure. | 732 | * @param cls Channel closure (channel wrapper). |
733 | * @param channel Connection to the other end (henceforth invalid). | 733 | * @param channel Connection to the other end (henceforth invalid). |
734 | */ | 734 | */ |
735 | static void | 735 | static void |
736 | disconnect_handler (void *cls, const struct GNUNET_CADET_Channel *channel) | 736 | disconnect_handler (void *cls, const struct GNUNET_CADET_Channel *channel) |
737 | { | 737 | { |
738 | long i = (long) cls; | 738 | struct CadetTestChannelWrapper *ch_w = cls; |
739 | 739 | ||
740 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 740 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Channel disconnected\n"); |
741 | "Channel disconnected at %p\n", cls); | 741 | GNUNET_assert (ch_w->ch == channel); |
742 | if (peers_running - 1 == i) | 742 | if (channel == incoming_ch) |
743 | { | 743 | { |
744 | ok++; | 744 | ok++; |
745 | GNUNET_break (channel == incoming_ch); | ||
746 | incoming_ch = NULL; | 745 | incoming_ch = NULL; |
747 | } | 746 | } |
748 | else if (0L == i) | 747 | else if (outgoing_ch == channel |
748 | ) | ||
749 | { | 749 | { |
750 | if (P2P_SIGNAL == test) | 750 | if (P2P_SIGNAL == test) |
751 | { | 751 | { |
752 | ok++; | 752 | ok++; |
753 | } | 753 | } |
754 | GNUNET_break (channel == outgoing_ch); | ||
755 | outgoing_ch = NULL; | 754 | outgoing_ch = NULL; |
756 | } | 755 | } |
757 | else | 756 | else |
758 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unknown peer! %d\n", (int) i); | 757 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unknown channel! %p\n", channel); |
759 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); | 758 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); |
760 | 759 | ||
761 | if (NULL != disconnect_task) | 760 | if (NULL != disconnect_task) |