handle disconnect properly in test
authorChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 13:18:35 +0000 (14:18 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 13:18:35 +0000 (14:18 +0100)
src/cadet/test_cadet_single.c

index 9bfaeda0d696374d2a3cd85ea816affc3850fdab..636def35d41ebd2acc8c032105fc96beaaf36c2b 100644 (file)
@@ -190,13 +190,18 @@ channel_end (void *cls, const struct GNUNET_CADET_Channel *channel,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "incoming channel closed at peer %ld\n",
               id);
-  if (REPETITIONS == repetition && channel == ch2)
+  if ( (REPETITIONS == repetition) &&
+       (channel == ch2) )
   {
-    ch2 = NULL;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "everything fine! finishing!\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "everything fine! finishing!\n");
     result = GNUNET_OK;
     GNUNET_SCHEDULER_shutdown ();
   }
+  if (channel == ch2)
+    ch2 = NULL;
+  if (channel == ch1)
+    ch1 = NULL;
 }