gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r23564 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r23564 - gnunet/src/gns
Date: Mon, 3 Sep 2012 13:44:34 +0200

Author: wachs
Date: 2012-09-03 13:44:34 +0200 (Mon, 03 Sep 2012)
New Revision: 23564

Modified:
   gnunet/src/gns/test_gns_simple_shorten.c
Log:
fix


Modified: gnunet/src/gns/test_gns_simple_shorten.c
===================================================================
--- gnunet/src/gns/test_gns_simple_shorten.c    2012-09-03 11:26:01 UTC (rev 
23563)
+++ gnunet/src/gns/test_gns_simple_shorten.c    2012-09-03 11:44:34 UTC (rev 
23564)
@@ -75,7 +75,27 @@
 struct GNUNET_CRYPTO_ShortHashCode priv_zone;
 struct GNUNET_CRYPTO_ShortHashCode short_zone;
 
+
 /**
+ * Check if the get_handle is being used, if so stop the request.  Either
+ * way, schedule the end_badly_cont function which actually shuts down the
+ * test.
+ */
+static void
+end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_SCHEDULER_shutdown ();
+  ok = 1;
+}
+
+void end_badly_now ()
+{
+  GNUNET_SCHEDULER_cancel (die_task);
+  die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+}
+
+
+/**
  * Called when gns shorten finishes
  */
 static void
@@ -83,11 +103,15 @@
 {
   GNUNET_GNS_disconnect(gns_handle);
 
+  if (GNUNET_SCHEDULER_NO_TASK != die_task)
+  {
+      GNUNET_SCHEDULER_cancel (die_task);
+      die_task = GNUNET_SCHEDULER_NO_TASK;
+  }
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Disconnecting from namestore\n");
   GNUNET_NAMESTORE_disconnect (namestore_handle);
-  ok = 0;
 
   if (sname == NULL)
   {
@@ -141,18 +165,7 @@
 }
 
 
-/**
- * Check if the get_handle is being used, if so stop the request.  Either
- * way, schedule the end_badly_cont function which actually shuts down the
- * test.
- */
-static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  ok = 1;
-}
 
-
 void do_check (void *cls,
               const struct GNUNET_CONFIGURATION_Handle *ccfg,
               struct GNUNET_TESTING_Peer *peer)
@@ -180,7 +193,7 @@
   if (NULL == namestore_handle)
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n");
-    ok = -1;
+    end_badly_now ();
     return;
   }
 
@@ -189,7 +202,7 @@
                                                           &our_keyfile))
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get key from cfg\n");
-    ok = -1;
+    end_badly_now ();
     return;
   }
   
@@ -199,7 +212,7 @@
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
                "Failed to get shorten zone key from cfg\n");
-    ok = -1;
+    end_badly_now ();
     return;
   }
   
@@ -209,7 +222,7 @@
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
                "Failed to get private zone key from cfg\n");
-    ok = -1;
+    end_badly_now ();
     return;
   }
 




reply via email to

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