gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37318 - gnunet/src/hostlist


From: gnunet
Subject: [GNUnet-SVN] r37318 - gnunet/src/hostlist
Date: Tue, 21 Jun 2016 13:44:29 +0200

Author: grothoff
Date: 2016-06-21 13:44:29 +0200 (Tue, 21 Jun 2016)
New Revision: 37318

Modified:
   gnunet/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
Log:
-fix testcase to manage with new shutdown semantics

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c 2016-06-21 
11:30:19 UTC (rev 37317)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c 2016-06-21 
11:44:29 UTC (rev 37318)
@@ -51,32 +51,6 @@
 static struct PeerContext p2;
 
 
-static void
-clean_up (void *cls)
-{
-  if (NULL != p1.ghh)
-  {
-    GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
-    p1.ghh = NULL;
-  }
-  if (p1.th != NULL)
-  {
-    GNUNET_TRANSPORT_disconnect (p1.th);
-    p1.th = NULL;
-  }
-  if (NULL != p2.ghh)
-  {
-    GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
-    p2.ghh = NULL;
-  }
-  if (p2.th != NULL)
-  {
-    GNUNET_TRANSPORT_disconnect (p2.th);
-    p2.th = NULL;
-  }
-  GNUNET_SCHEDULER_shutdown ();
-}
-
 /**
  * Timeout, give up.
  */
@@ -86,7 +60,7 @@
   timeout_task = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Timeout trying to connect peers, test failed.\n");
-  clean_up (NULL);
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -108,12 +82,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Peers connected, shutting down.\n");
   ok = 0;
-  if (timeout_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = NULL;
-  }
-  GNUNET_SCHEDULER_add_now (&clean_up, NULL);
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -185,6 +154,31 @@
 static void
 shutdown_task (void *cls)
 {
+  if (NULL != timeout_task)
+  {
+    GNUNET_SCHEDULER_cancel (timeout_task);
+    timeout_task = NULL;
+  }
+  if (NULL != p1.ghh)
+  {
+    GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
+    p1.ghh = NULL;
+  }
+  if (p1.th != NULL)
+  {
+    GNUNET_TRANSPORT_disconnect (p1.th);
+    p1.th = NULL;
+  }
+  if (NULL != p2.ghh)
+  {
+    GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
+    p2.ghh = NULL;
+  }
+  if (p2.th != NULL)
+  {
+    GNUNET_TRANSPORT_disconnect (p2.th);
+    p2.th = NULL;
+  }
   stop_arm (&p1);
   stop_arm (&p2);
 }
@@ -198,9 +192,8 @@
   ok++;
   timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                               &timeout_error, NULL);
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                               &shutdown_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
   setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf");
   setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf");
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]