From 82bc20a8bcbfb269da4dd54476382c924497e7ec Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Fri, 26 Oct 2012 12:58:46 +0000 Subject: [PATCH] removed GNUNET_TESTBED_operation_cancel --- src/fs/fs_test_lib.c | 4 +-- src/gns/test_gns_dht_three_peers.c | 4 +-- src/include/gnunet_testbed_service.h | 35 +++++++++++++-------------- src/mesh/gnunet-regex-profiler.c | 8 +++--- src/testbed/gnunet-service-testbed.c | 2 +- src/testbed/gnunet-testbed-profiler.c | 4 +-- src/testbed/testbed_api_testbed.c | 2 +- src/testbed/testbed_api_topology.c | 2 +- 8 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index 334551964..4323bc66d 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -212,7 +212,7 @@ publish_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout while trying to publish data\n"); if (NULL == po->fs) - GNUNET_TESTBED_operation_cancel (po->fs_op); + GNUNET_TESTBED_operation_done (po->fs_op); else GNUNET_TESTBED_operation_done (po->fs_op); GNUNET_FS_publish_stop (po->publish_context); @@ -486,7 +486,7 @@ download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) dop->download_cont_cls, GNUNET_SCHEDULER_REASON_TIMEOUT); if (NULL == dop->fs) - GNUNET_TESTBED_operation_cancel (dop->fs_op); + GNUNET_TESTBED_operation_done (dop->fs_op); else GNUNET_TESTBED_operation_done (dop->fs_op); GNUNET_FS_uri_destroy (dop->uri); diff --git a/src/gns/test_gns_dht_three_peers.c b/src/gns/test_gns_dht_three_peers.c index 7f5012311..a7bad9bba 100644 --- a/src/gns/test_gns_dht_three_peers.c +++ b/src/gns/test_gns_dht_three_peers.c @@ -107,12 +107,12 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != get_cfg_ops[c]) { - GNUNET_TESTBED_operation_cancel(get_cfg_ops[c]); + GNUNET_TESTBED_operation_done(get_cfg_ops[c]); get_cfg_ops[c] = NULL; } if (NULL != connect_ops[c]) { - GNUNET_TESTBED_operation_cancel(connect_ops[c]); + GNUNET_TESTBED_operation_done(connect_ops[c]); connect_ops[c] = NULL; } if (NULL != cfg_handles[c]) diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index f4c02fbad..c2c6812f4 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h @@ -1188,26 +1188,25 @@ GNUNET_TESTBED_service_connect (void *op_cls, /** - * Cancel a pending operation. Releases all resources - * of the operation and will ensure that no event - * is generated for the operation. Does NOT guarantee - * that the operation will be fully undone (or that - * nothing ever happened). + * This function is used to signal that the event information (struct + * GNUNET_TESTBED_EventInformation) from an operation has been fully processed + * i.e. if the event callback is ever called for this operation. If the event + * callback for this operation has not yet been called, calling this function + * cancels the operation, frees its resources and ensures the no event is + * generated with respect to this operation. Note that however cancelling an + * operation does NOT guarantee that the operation will be fully undone (or that + * nothing ever happened). * - * @param operation operation to cancel - */ -void -GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation); - - -/** - * Signal that the information from an operation has been fully - * processed. This function MUST be called for each event - * of type 'operation_finished' to fully remove the operation - * from the operation queue. After calling this function, the - * 'op_result' becomes invalid (!). + * This function MUST be called for every operation to fully remove the + * operation from the operation queue. After calling this function, if + * operation is completed and its event information is of type + * GNUNET_TESTBED_ET_OPERATION_FINISHED, the 'op_result' becomes invalid (!). + + * If the operation is generated from GNUNET_TESTBED_service_connect() then + * calling this function on such as operation calls the disconnect adapter if + * the connect adapter was ever called. * - * @param operation operation to signal completion for + * @param operation operation to signal completion or cancellation */ void GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c index e6178eac6..622842332 100644 --- a/src/mesh/gnunet-regex-profiler.c +++ b/src/mesh/gnunet-regex-profiler.c @@ -395,9 +395,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) { if (NULL != peers[peer_cnt].mesh_op_handle) - GNUNET_TESTBED_operation_cancel (peers[peer_cnt].mesh_op_handle); + GNUNET_TESTBED_operation_done (peers[peer_cnt].mesh_op_handle); if (NULL != peers[peer_cnt].stats_op_handle) - GNUNET_TESTBED_operation_cancel (peers[peer_cnt].stats_op_handle); + GNUNET_TESTBED_operation_done (peers[peer_cnt].stats_op_handle); } for (search_str_cnt = 0; search_str_cnt < num_search_strings; search_str_cnt++) { @@ -411,14 +411,14 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != topology_op) - GNUNET_TESTBED_operation_cancel (topology_op); + GNUNET_TESTBED_operation_done (topology_op); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hosts[nhost]) GNUNET_TESTBED_host_destroy (hosts[nhost]); GNUNET_free_non_null (hosts); while (NULL != (dll_op = dll_op_head)) { - GNUNET_TESTBED_operation_cancel (dll_op->op); + GNUNET_TESTBED_operation_done (dll_op->op); GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); GNUNET_free (dll_op); } diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 81cf29c5f..1ece6c6bb 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c @@ -3672,7 +3672,7 @@ reghost_free_iterator (void *cls, cleanup_focc (focc); } if (NULL != rhc->sub_op) - GNUNET_TESTBED_operation_cancel (rhc->sub_op); + GNUNET_TESTBED_operation_done (rhc->sub_op); if (NULL != rhc->client) GNUNET_SERVER_client_drop (rhc->client); GNUNET_free (value); diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 4168408e9..0d9143a86 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -258,14 +258,14 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != topology_op) - GNUNET_TESTBED_operation_cancel (topology_op); + GNUNET_TESTBED_operation_done (topology_op); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hosts[nhost]) GNUNET_TESTBED_host_destroy (hosts[nhost]); GNUNET_free_non_null (hosts); while (NULL != (dll_op = dll_op_head)) { - GNUNET_TESTBED_operation_cancel (dll_op->op); + GNUNET_TESTBED_operation_done (dll_op->op); GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); GNUNET_free (dll_op); } diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 02b20d214..96ac22c2b 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -271,7 +271,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) _("Some operations are still pending. Cancelling them\n")); while (NULL != (dll_op = rc->dll_op_head)) { - GNUNET_TESTBED_operation_cancel (dll_op->op); + GNUNET_TESTBED_operation_done (dll_op->op); GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op); GNUNET_free (dll_op); } diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index 84202ec8c..edf0f5d3f 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c @@ -177,7 +177,7 @@ oprelease_overlay_configure_topology (void *cls) { for (p = 0; p < tc->link_array_size; p++) if (NULL != tc->link_array[p].op) - GNUNET_TESTBED_operation_cancel (tc->link_array[p].op); + GNUNET_TESTBED_operation_done (tc->link_array[p].op); GNUNET_free (tc->link_array); } GNUNET_free (tc); -- 2.25.1