another connect_task init missing
authorChristian Grothoff <christian@grothoff.org>
Sat, 21 Jan 2017 23:34:55 +0000 (00:34 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 21 Jan 2017 23:34:55 +0000 (00:34 +0100)
src/cadet/test_cadet_local.c

index 05cfdb1ba971e4ecdb5ab641c99723ccb1fa9a52..ddd294d6b7545b0ad0ca7a0e5f77f5aba80d3737 100644 (file)
@@ -80,13 +80,15 @@ do_shutdown (void *cls)
     GNUNET_CADET_channel_destroy (ch);
     ch = NULL;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Disconnect client 1\n");
   if (NULL != cadet_peer_1)
   {
     GNUNET_CADET_disconnect (cadet_peer_1);
     cadet_peer_1 = NULL;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Disconnect client 2\n");
   if (NULL != cadet_peer_2)
   {
     GNUNET_CADET_disconnect (cadet_peer_2);
@@ -196,10 +198,12 @@ channel_end (void *cls,
     ch = NULL;
   if (GNUNET_NO == got_data)
   {
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
-                                  GNUNET_TIME_UNIT_SECONDS,
-                                  2),
-                                  &do_connect, NULL);
+    if (NULL == connect_task)
+      connect_task
+        = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+                                                                       2),
+                                        &do_connect,
+                                        NULL);
   }
 }
 
@@ -298,13 +302,13 @@ run (void *cls,
                                      (void *) 1L,       /* cls */
                                      &channel_end,      /* channel end hndlr */
                                      handlers1); /* traffic handlers */
-
   cadet_peer_2 = GNUNET_CADET_connect (cfg,       /* configuration */
                                      (void *) 2L,     /* cls */
                                      &channel_end,      /* channel end hndlr */
                                      handlers2); /* traffic handlers */
 
-  if (NULL == cadet_peer_1 || NULL == cadet_peer_2)
+  if ( (NULL == cadet_peer_1) ||
+       (NULL == cadet_peer_2) )
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Couldn't connect to cadet :(\n");