gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24522 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r24522 - gnunet/src/testbed
Date: Wed, 24 Oct 2012 22:34:03 +0200

Author: harsha
Date: 2012-10-24 22:34:03 +0200 (Wed, 24 Oct 2012)
New Revision: 24522

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
   gnunet/src/testbed/test_testbed_api_operations.c
   gnunet/src/testbed/testbed_api.c
   gnunet/src/testbed/testbed_api_operations.c
   gnunet/src/testbed/testbed_api_operations.h
   gnunet/src/testbed/testbed_api_peers.c
   gnunet/src/testbed/testbed_api_services.c
   gnunet/src/testbed/testbed_api_topology.c
   gnunet/src/testbed/x64_misc.supp
Log:
multiple operation queues for an operation

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-10-24 20:34:03 UTC (rev 
24522)
@@ -3265,8 +3265,8 @@
           /* rhc is now set to the existing one from the hash map by
              reghost_match_iterator() */
           /* if queue is empty then ignore creating focc and proceed with
-             normal forwarding */
-          if (NULL == rhc->focc_dll_head)
+             normal forwarding */                
+          if (RHC_OL_CONNECT == rhc->state)
             skip_focc = GNUNET_YES;
         }
         if (GNUNET_NO == skip_focc)

Modified: gnunet/src/testbed/test_testbed_api_operations.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_operations.c    2012-10-24 16:08:23 UTC 
(rev 24521)
+++ gnunet/src/testbed/test_testbed_api_operations.c    2012-10-24 20:34:03 UTC 
(rev 24522)
@@ -194,8 +194,10 @@
   op2 = GNUNET_TESTBED_operation_create_ (&op2, start_cb, release_cb);
   GNUNET_TESTBED_operation_queue_insert_ (q1, op1);
   GNUNET_TESTBED_operation_queue_insert_ (q2, op1);
+  GNUNET_TESTBED_operation_begin_wait_ (op1);
   GNUNET_TESTBED_operation_queue_insert_ (q1, op2);
   GNUNET_TESTBED_operation_queue_insert_ (q2, op2);
+  GNUNET_TESTBED_operation_begin_wait_ (op2);
   result = TEST_INIT;
 }
 

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2012-10-24 16:08:23 UTC (rev 24521)
+++ gnunet/src/testbed/testbed_api.c    2012-10-24 20:34:03 UTC (rev 24522)
@@ -1884,6 +1884,7 @@
                                         &oprelease_link_controllers);
   GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -2103,6 +2104,7 @@
                                         &oprelease_get_slave_config);
   GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
                                          opc->op); 
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 

Modified: gnunet/src/testbed/testbed_api_operations.c
===================================================================
--- gnunet/src/testbed/testbed_api_operations.c 2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/testbed_api_operations.c 2012-10-24 20:34:03 UTC (rev 
24522)
@@ -78,14 +78,24 @@
  */
 enum OperationState
 {
-    /**
-     * The operation is currently waiting for resources
-     */
+  /**
+   * The operation is just created and is in initial state
+   */
+  OP_STATE_INIT,
+  
+  /**
+   * The operation is currently waiting for resources
+   */
   OP_STATE_WAITING,
-
-    /**
-     * The operation has started
-     */
+  
+  /**
+   * The operation is ready to be started
+   */
+  OP_STATE_READY,
+  
+  /**
+   * The operation has started
+   */
   OP_STATE_STARTED
 };
 
@@ -164,8 +174,7 @@
 {
   unsigned int i;
 
-  if (GNUNET_SCHEDULER_NO_TASK != op->start_task_id)
-    return;
+  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == op->start_task_id);
   for (i = 0; i < op->nqueues; i++)
   {
     if (0 == op->queues[i]->active)
@@ -175,6 +184,7 @@
   {
     op->queues[i]->active--;
   }
+  op->state = OP_STATE_READY;
   op->start_task_id = GNUNET_SCHEDULER_add_now (&call_start, op);
 }
 
@@ -195,6 +205,7 @@
 
   op = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Operation));
   op->start = start;
+  op->state = OP_STATE_INIT;
   op->release = release;
   op->cb_cls = cls;
   op->start_task_id = GNUNET_SCHEDULER_NO_TASK;
@@ -236,13 +247,10 @@
 
 
 /**
- * Add an operation to a queue.  An operation can be in multiple
- * queues at once.  Once all queues permit the operation to become
- * active, the operation will be activated.  The actual activation
- * will occur in a separate task (thus allowing multiple queue
- * insertions to be made without having the first one instantly
- * trigger the operation if the first queue has sufficient
- * resources).
+ * Add an operation to a queue.  An operation can be in multiple queues at
+ * once. Once the operation is inserted into all the queues
+ * GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start
+ * waiting for the operation to become active.
  *
  * @param queue queue to add the operation to
  * @param operation operation to add to the queue
@@ -262,6 +270,24 @@
                       sizeof (struct OperationQueue *) *
                       (++operation->nqueues));
   operation->queues[operation->nqueues - 1] = queue;
+}
+
+
+/**
+ * Marks the given operation as waiting on the queues.  Once all queues permit
+ * the operation to become active, the operation will be activated.  The actual
+ * activation will occur in a separate task (thus allowing multiple queue
+ * insertions to be made without having the first one instantly trigger the
+ * operation if the first queue has sufficient resources).
+ *
+ * @param operation the operation to marks as waiting
+ */
+void
+GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation
+                                     *operation)
+{
+  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == operation->start_task_id);
+  operation->state = OP_STATE_WAITING;
   check_readiness (operation);
 }
 
@@ -293,7 +319,7 @@
   GNUNET_CONTAINER_DLL_remove (queue->head, queue->tail, entry);
   GNUNET_free (entry);
   for (; NULL != entry2; entry2 = entry2->next)
-    if (OP_STATE_STARTED != entry2->op->state)
+    if (OP_STATE_WAITING == entry2->op->state)
       break;
   if (NULL == entry2)
     return;

Modified: gnunet/src/testbed/testbed_api_operations.h
===================================================================
--- gnunet/src/testbed/testbed_api_operations.h 2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/testbed_api_operations.h 2012-10-24 20:34:03 UTC (rev 
24522)
@@ -59,13 +59,10 @@
 
 
 /**
- * Add an operation to a queue.  An operation can be in multiple
- * queues at once.  Once all queues permit the operation to become
- * active, the operation will be activated.  The actual activation
- * will occur in a separate task (thus allowing multiple queue
- * insertions to be made without having the first one instantly
- * trigger the operation if the first queue has sufficient
- * resources).
+ * Add an operation to a queue.  An operation can be in multiple queues at
+ * once. Once the operation is inserted into all the queues
+ * GNUNET_TESTBED_operation_begin_wait_() has to be called to actually start
+ * waiting for the operation to become active.
  *
  * @param queue queue to add the operation to
  * @param operation operation to add to the queue
@@ -77,6 +74,20 @@
 
 
 /**
+ * Marks the given operation as waiting on the queues.  Once all queues permit
+ * the operation to become active, the operation will be activated.  The actual
+ * activation will occur in a separate task (thus allowing multiple queue
+ * insertions to be made without having the first one instantly trigger the
+ * operation if the first queue has sufficient resources).
+ *
+ * @param operation the operation to marks as waiting
+ */
+void
+GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation
+                                     *operation);
+
+
+/**
  * Remove an operation from a queue.  This can be because the
  * oeration was active and has completed (and the resources have
  * been released), or because the operation was cancelled and

Modified: gnunet/src/testbed/testbed_api_peers.c
===================================================================
--- gnunet/src/testbed/testbed_api_peers.c      2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/testbed_api_peers.c      2012-10-24 20:34:03 UTC (rev 
24522)
@@ -452,6 +452,7 @@
                                         &oprelease_peer_create);
   GNUNET_TESTBED_operation_queue_insert_ (controller->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -532,6 +533,7 @@
                                         &oprelease_peer_start);
   GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -568,6 +570,7 @@
                                         &oprelease_peer_stop);
   GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -611,6 +614,7 @@
                                         &oprelease_peer_getinfo);
   GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -658,6 +662,7 @@
                                         &oprelease_peer_destroy);
   GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -730,6 +735,7 @@
   /*                                         opc->op); */
   GNUNET_TESTBED_operation_queue_insert_
       (opc->c->opq_parallel_overlay_connect_operations, opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 

Modified: gnunet/src/testbed/testbed_api_services.c
===================================================================
--- gnunet/src/testbed/testbed_api_services.c   2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/testbed_api_services.c   2012-10-24 20:34:03 UTC (rev 
24522)
@@ -282,6 +282,7 @@
   GNUNET_TESTBED_operation_queue_insert_ (peer->
                                           controller->opq_parallel_operations,
                                           data->operation);
+  GNUNET_TESTBED_operation_begin_wait_ (data->operation);
   return data->operation;
 }
 

Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c   2012-10-24 16:08:23 UTC (rev 
24521)
+++ gnunet/src/testbed/testbed_api_topology.c   2012-10-24 20:34:03 UTC (rev 
24522)
@@ -349,6 +349,7 @@
                                         &oprelease_overlay_configure_topology);
   GNUNET_TESTBED_operation_queue_insert_
       (c->opq_parallel_topology_config_operations, op);
+  GNUNET_TESTBED_operation_begin_wait_ (op);
   return op;
 }
 

Modified: gnunet/src/testbed/x64_misc.supp
===================================================================
--- gnunet/src/testbed/x64_misc.supp    2012-10-24 16:08:23 UTC (rev 24521)
+++ gnunet/src/testbed/x64_misc.supp    2012-10-24 20:34:03 UTC (rev 24522)
@@ -22,3 +22,13 @@
    obj:/home/harsha/repos/gnunet/src/util/.libs/libgnunetutil.so.8.0.0
 }
 
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   fun:malloc
+   ...
+   fun:gcry_control
+   fun:GNUNET_CRYPTO_random_init
+   obj:/home/totakura/gnunet/src/util/.libs/libgnunetutil.so.8.0.0
+   obj:/home/totakura/gnunet/src/util/.libs/libgnunetutil.so.8.0.0
+}




reply via email to

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