multiple operation queues for an operation
[oweals/gnunet.git] / src / testbed / testbed_api.c
index e5722218a9c3f1d6e34fa1045eb1c29ba58327f0..c55e7373a00bc72ded931b034ce82b07ecb5d558 100644 (file)
@@ -724,13 +724,13 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
     LOG_DEBUG ("Operation not found\n");
     return GNUNET_YES;
   }
-  GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
   if (OP_FORWARDED == opc->type)
   {
     handle_forwarded_operation_msg (c, opc,
                                    (const struct GNUNET_MessageHeader *) msg);
     return GNUNET_YES;
   }
+  GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
   opc->state = OPC_STATE_FINISHED;
   emsg = GNUNET_TESTBED_parse_error_string_ (msg);
   if (NULL == emsg)
@@ -1884,6 +1884,7 @@ GNUNET_TESTBED_controller_link_2_ (void *op_cls,
                                         &oprelease_link_controllers);
   GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
                                           opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
   return opc->op;
 }
 
@@ -1934,7 +1935,6 @@ GNUNET_TESTBED_controller_link_2 (void *op_cls,
                                             slave_host_id,
                                             sxcfg, sxcfg_size,
                                             scfg_size, is_subordinate);
-  GNUNET_break (0);
 }
 
 
@@ -2054,8 +2054,9 @@ GNUNET_TESTBED_controller_link (void *op_cls,
 
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
-  slave_host_id = (NULL == slave_host) ?
-      0 : GNUNET_TESTBED_host_get_id_ (slave_host);
+  slave_host_id = 
+      GNUNET_TESTBED_host_get_id_ ((NULL != slave_host)
+                                   ? slave_host : master->host);
   delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
   if ((NULL != slave_host) && (0 != slave_host_id))
     GNUNET_assert (GNUNET_YES ==
@@ -2103,6 +2104,7 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls,
                                         &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;
 }
 
@@ -2231,21 +2233,7 @@ GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation)
 void
 GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
 {
-  switch (operation->type)
-  {
-  case OP_PEER_CREATE:
-  case OP_PEER_DESTROY:
-  case OP_PEER_START:
-  case OP_PEER_STOP:
-  case OP_PEER_INFO:
-  case OP_OVERLAY_CONNECT:
-  case OP_LINK_CONTROLLERS:
     GNUNET_TESTBED_operation_release_ (operation);
-    return;
-  default:
-    GNUNET_assert (0);
-    break;
-  }
 }