diff options
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r-- | src/testbed/testbed_api.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 9bed63a97..2dab869dc 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -959,7 +959,7 @@ handle_need_controller_config (struct GNUNET_TESTBED_Controller *c, | |||
959 | uint64_t sub_op_id; | 959 | uint64_t sub_op_id; |
960 | 960 | ||
961 | GNUNET_assert (NULL == oc_data->sub_opc); | 961 | GNUNET_assert (NULL == oc_data->sub_opc); |
962 | sub_op_id = oc_data->p1->controller->operation_counter++; | 962 | sub_op_id = GNUNET_TESTBED_get_next_op_id (oc_data->p1->controller); |
963 | get_cfg_msg = | 963 | get_cfg_msg = |
964 | GNUNET_TESTBED_generate_slavegetconfig_msg_ | 964 | GNUNET_TESTBED_generate_slavegetconfig_msg_ |
965 | (sub_op_id, GNUNET_TESTBED_host_get_id_ (oc_data->p2->host)); | 965 | (sub_op_id, GNUNET_TESTBED_host_get_id_ (oc_data->p2->host)); |
@@ -1873,7 +1873,7 @@ GNUNET_TESTBED_controller_link_2 (void *op_cls, | |||
1873 | opc->c = master; | 1873 | opc->c = master; |
1874 | opc->data = data; | 1874 | opc->data = data; |
1875 | opc->type = OP_LINK_CONTROLLERS; | 1875 | opc->type = OP_LINK_CONTROLLERS; |
1876 | opc->id = master->operation_counter++; | 1876 | opc->id = GNUNET_TESTBED_get_next_op_id (opc->c); |
1877 | opc->state = OPC_STATE_INIT; | 1877 | opc->state = OPC_STATE_INIT; |
1878 | msg->operation_id = GNUNET_htonll (opc->id); | 1878 | msg->operation_id = GNUNET_htonll (opc->id); |
1879 | opc->op = | 1879 | opc->op = |
@@ -2003,7 +2003,7 @@ GNUNET_TESTBED_get_slave_config (void *op_cls, | |||
2003 | opc = GNUNET_malloc (sizeof (struct OperationContext)); | 2003 | opc = GNUNET_malloc (sizeof (struct OperationContext)); |
2004 | opc->state = OPC_STATE_INIT; | 2004 | opc->state = OPC_STATE_INIT; |
2005 | opc->c = master; | 2005 | opc->c = master; |
2006 | opc->id = master->operation_counter++; | 2006 | opc->id = GNUNET_TESTBED_get_next_op_id (master); |
2007 | opc->type = OP_GET_SLAVE_CONFIG; | 2007 | opc->type = OP_GET_SLAVE_CONFIG; |
2008 | opc->data = data; | 2008 | opc->data = data; |
2009 | opc->op = | 2009 | opc->op = |
@@ -2220,4 +2220,23 @@ GNUNET_TESTBED_parse_error_string_ (const struct | |||
2220 | return emsg; | 2220 | return emsg; |
2221 | } | 2221 | } |
2222 | 2222 | ||
2223 | |||
2224 | /** | ||
2225 | * Function to return the operation id for a controller. The operation id is | ||
2226 | * created from the controllers host id and its internal operation counter. | ||
2227 | * | ||
2228 | * @param controller the handle to the controller whose operation id has to be incremented | ||
2229 | * @return the incremented operation id. | ||
2230 | */ | ||
2231 | uint64_t | ||
2232 | GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller *controller) | ||
2233 | { | ||
2234 | uint64_t op_id; | ||
2235 | |||
2236 | op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host); | ||
2237 | op_id = op_id << 32; | ||
2238 | op_id |= (uint64_t) controller->operation_counter++; | ||
2239 | return op_id; | ||
2240 | } | ||
2241 | |||
2223 | /* end of testbed_api.c */ | 2242 | /* end of testbed_api.c */ |