gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28987 - in gnunet/src: include testbed


From: gnunet
Subject: [GNUnet-SVN] r28987 - in gnunet/src: include testbed
Date: Wed, 4 Sep 2013 17:00:03 +0200

Author: harsha
Date: 2013-09-04 17:00:03 +0200 (Wed, 04 Sep 2013)
New Revision: 28987

Modified:
   gnunet/src/include/gnunet_testbed_service.h
   gnunet/src/testbed/test_testbed_api_testbed_run.c
   gnunet/src/testbed/testbed_api_testbed.c
Log:
- remove dead code and fixes


Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2013-09-04 14:24:14 UTC (rev 
28986)
+++ gnunet/src/include/gnunet_testbed_service.h 2013-09-04 15:00:03 UTC (rev 
28987)
@@ -615,36 +615,6 @@
 
 
 /**
- * Same as the GNUNET_TESTBED_controller_link, however expects configuration in
- * serialized and compressed
- *
- * @param op_cls the operation closure for the event which is generated to
- *          signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host requests to which host should be delegated; cannot be 
NULL
- * @param slave_host which host is used to run the slave controller; use NULL 
to
- *          make the master controller connect to the delegated host
- * @param sxcfg serialized and compressed configuration
- * @param sxcfg_size the size sxcfg
- * @param scfg_size the size of uncompressed serialized configuration
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- *          be started by the slave controller; GNUNET_NO if the slave
- *          controller has to connect to the already started delegated
- *          controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_2 (void *op_cls,
-                                  struct GNUNET_TESTBED_Controller *master,
-                                  struct GNUNET_TESTBED_Host *delegated_host,
-                                  struct GNUNET_TESTBED_Host *slave_host,
-                                  const char *sxcfg,
-                                  size_t sxcfg_size,
-                                  size_t scfg_size,
-                                  int is_subordinate);
-
-
-/**
  * Function to acquire the configuration of a running slave controller. The
  * completion of the operation is signalled through the controller_cb from
  * GNUNET_TESTBED_controller_connect(). If the operation is successful the

Modified: gnunet/src/testbed/test_testbed_api_testbed_run.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_testbed_run.c   2013-09-04 14:24:14 UTC 
(rev 28986)
+++ gnunet/src/testbed/test_testbed_api_testbed_run.c   2013-09-04 15:00:03 UTC 
(rev 28987)
@@ -114,6 +114,8 @@
   result = GNUNET_OK;
   if (GNUNET_YES == wait_forever)
   {
+    if (GNUNET_SCHEDULER_NO_TASK == abort_task)
+      return;                   /* abort already scheduled */
     GNUNET_SCHEDULER_cancel (abort_task);
     abort_task = GNUNET_SCHEDULER_NO_TASK;
     (void) GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,

Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c    2013-09-04 14:24:14 UTC (rev 
28986)
+++ gnunet/src/testbed/testbed_api_testbed.c    2013-09-04 15:00:03 UTC (rev 
28987)
@@ -257,6 +257,11 @@
   GNUNET_SCHEDULER_TaskIdentifier interrupt_task;
 
   /**
+   * Task for cleaning up the run context and various resources it uses
+   */
+  GNUNET_SCHEDULER_TaskIdentifier cleanup_task;
+
+  /**
    * The event mask for the controller
    */
   uint64_t event_mask;
@@ -443,7 +448,7 @@
  * @param tc the task context from scheduler
  */
 static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct RunContext *rc = cls;
   unsigned int hid;
@@ -473,6 +478,20 @@
 
 
 /**
+ * Perform the cleanup task now
+ *
+ * @param rc the run context to be cleaned up
+ */
+static void
+cleanup_now (struct RunContext *rc)
+{
+  if (GNUNET_SCHEDULER_NO_TASK != rc->cleanup_task)
+    GNUNET_SCHEDULER_cancel (rc->cleanup_task);
+  rc->cleanup_task = GNUNET_SCHEDULER_add_now (&cleanup, rc);
+}
+
+
+/**
  * Iterator for cleaning up elements from rcop_map 
  *
  * @param cls the RunContext
@@ -495,13 +514,27 @@
 
 
 /**
- * Frees memory, closes pending operations, cancels actives tasks of the given
- * RunContext 
+ * Cleanup existing operation in given run context
  *
+ * @param rc the run context
+ */
+static void
+cleanup_operations (struct RunContext *rc)
+{
+  GNUNET_assert (GNUNET_SYSERR != 
+                 GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map,
+                                                          
&rcop_cleanup_iterator,
+                                                          rc));
+}
+
+
+/**
+ * Cancels operations and tasks which are assigned to the given run context
+ *
  * @param rc the RunContext
  */
 static void
-cleanup (struct RunContext *rc)
+rc_cleanup_operations (struct RunContext *rc)
 {
   struct CompatibilityCheckContext *hc;
   unsigned int nhost;
@@ -544,10 +577,7 @@
     rc->topology_operation = NULL;
   }
   /* cancel any exiting operations */
-  GNUNET_assert (GNUNET_SYSERR != 
-                 GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map,
-                                                          
&rcop_cleanup_iterator,
-                                                          rc));
+  cleanup_operations (rc);
 }
 
 
@@ -567,7 +597,7 @@
   rc->shutdown_run_task = GNUNET_SCHEDULER_NO_TASK;
   GNUNET_assert (GNUNET_NO == rc->shutdown);
   rc->shutdown = GNUNET_YES;
-  cleanup (rc);
+  rc_cleanup_operations (rc);
   if (NULL != rc->c)
   {
     if (NULL != rc->peers)
@@ -584,7 +614,7 @@
   }
   rc->state = RC_PEERS_SHUTDOWN;       /* No peers are present so we consider 
the
                                         * state where all peers are SHUTDOWN  
*/
-  GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
+  cleanup_now (rc);
 }
 
 
@@ -845,7 +875,7 @@
     GNUNET_free_non_null (rc->peers);
     rc->peers = NULL;
     DEBUG ("Peers shut down in %s\n", prof_time (rc));
-    GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
+    cleanup_now (rc);
     break;
   default:
     GNUNET_assert (0);
@@ -1008,7 +1038,7 @@
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("Controller crash detected. Shutting down.\n"));
     rc->cproc = NULL;
-    cleanup (rc);
+    rc_cleanup_operations (rc);
     if (NULL != rc->peers)
     {
       GNUNET_free (rc->peers);
@@ -1017,7 +1047,7 @@
     if (GNUNET_YES == rc->shutdown)
     {
       rc->state = RC_PEERS_SHUTDOWN;
-      GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
+      cleanup_now (rc);
     }
     else
       shutdown_now (rc);




reply via email to

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