gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20963 - gnunet/src/gns
Date: Thu, 12 Apr 2012 14:55:56 +0200

Author: schanzen
Date: 2012-04-12 14:55:56 +0200 (Thu, 12 Apr 2012)
New Revision: 20963

Modified:
   gnunet/src/gns/test_gns_pseu_shorten.c
Log:
-fixes


Modified: gnunet/src/gns/test_gns_pseu_shorten.c
===================================================================
--- gnunet/src/gns/test_gns_pseu_shorten.c      2012-04-12 12:22:36 UTC (rev 
20962)
+++ gnunet/src/gns/test_gns_pseu_shorten.c      2012-04-12 12:55:56 UTC (rev 
20963)
@@ -67,8 +67,10 @@
 static struct GNUNET_TESTING_PeerGroup *pg;
 
 /* Task handle to use to schedule test failure */
-GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
 
+static GNUNET_SCHEDULER_TaskIdentifier disco_task;
+
 /* Global return value (0 for success, anything else for failure) */
 static int ok;
 
@@ -95,6 +97,14 @@
 void
 shutdown_callback (void *cls, const char *emsg)
 {
+  if (disco_task != GNUNET_SCHEDULER_NO_TASK)
+  {
+    disco_task = GNUNET_SCHEDULER_NO_TASK;
+    GNUNET_SCHEDULER_cancel(disco_task);
+    GNUNET_DHT_disconnect(dht_handle);
+    dht_handle = NULL;
+  }
+
   if (emsg != NULL)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error on shutdown! ret=%d\n", ok);
@@ -108,6 +118,7 @@
 static void
 disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  disco_task = GNUNET_SCHEDULER_NO_TASK;
   GNUNET_DHT_disconnect(dht_handle);
   dht_handle = NULL;
 }
@@ -229,26 +240,22 @@
  * down the peers without freeing memory associated with GET request.
  */
 static void
-end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-
-  if (pg != NULL)
-    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-  GNUNET_SCHEDULER_cancel (die_task);
-}
-
-/**
- * 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_log (GNUNET_ERROR_TYPE_ERROR, "Failing test with error: `%s'!\n",
               (char *) cls);
-  GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL);
   ok = 1;
+  
+  if (disco_task != GNUNET_SCHEDULER_NO_TASK)
+  {
+    disco_task = GNUNET_SCHEDULER_NO_TASK;
+    GNUNET_SCHEDULER_cancel(disco_task);
+    GNUNET_DHT_disconnect(dht_handle);
+    dht_handle = NULL;
+  }
+  if (pg != NULL)
+    GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
+  GNUNET_SCHEDULER_cancel (die_task);
 }
 
 static void




reply via email to

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