/** * Re-establish the connection to the service. * * @param cls handle to use to re-connect. * @param tc scheduler context */ static void endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != nsqe) { GNUNET_NAMESTORE_cancel (nsqe); nsqe = NULL; } if (NULL != ncqe) { GNUNET_NAMECACHE_cancel (ncqe); ncqe = NULL; } cleanup (); res = 1; }
/** * Function run on shutdown. * * @param cls closure */ static void do_shutdown (void *cls) { if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = NULL; } if (NULL != op) { GNUNET_IDENTITY_cancel (op); op = NULL; } if (NULL != call1) { GNUNET_CONVERSATION_call_stop (call1); call1 = NULL; } if (NULL != call2) { GNUNET_CONVERSATION_call_stop (call2); call2 = NULL; } if (NULL != phone) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from PHONE service.\n"); GNUNET_CONVERSATION_phone_destroy (phone); phone = NULL; } if (NULL != id) { GNUNET_IDENTITY_disconnect (id); id = NULL; } if (NULL != qe) { GNUNET_NAMESTORE_cancel (qe); qe = NULL; } if (NULL != ns) { GNUNET_NAMESTORE_disconnect (ns); ns = NULL; } }
/** * Cleanup task */ static void cleanup() { struct EgoEntry *ego_entry; struct EgoEntry *ego_tmp; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); if (NULL != timeout_task) GNUNET_SCHEDULER_cancel (timeout_task); if (NULL != update_task) GNUNET_SCHEDULER_cancel (update_task); if (NULL != identity_handle) GNUNET_IDENTITY_disconnect (identity_handle); if (NULL != ns_it) GNUNET_NAMESTORE_zone_iteration_stop (ns_it); if (NULL != ns_qe) GNUNET_NAMESTORE_cancel (ns_qe); if (NULL != ns_handle) GNUNET_NAMESTORE_disconnect (ns_handle); if (NULL != token) GNUNET_free (token); if (NULL != label) GNUNET_free (label); for (ego_entry = ego_head; NULL != ego_entry;) { ego_tmp = ego_entry; if (0 != GNUNET_CONTAINER_multihashmap_size (ego_tmp->attr_map)) { GNUNET_CONTAINER_multihashmap_iterate (ego_tmp->attr_map, &clear_ego_attrs, ego_tmp); } GNUNET_CONTAINER_multihashmap_destroy (ego_tmp->attr_map); ego_entry = ego_entry->next; GNUNET_free (ego_tmp); } }
/** * Signature of the main function of a task. * * @param cls closure * @param tc context information (why was this task triggered now) */ static void end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_SCHEDULER_shutdown (); if (NULL != op) { GNUNET_IDENTITY_cancel (op); op = NULL; } if (NULL != call) { GNUNET_CONVERSATION_call_stop (call); call = NULL; } if (NULL != phone) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from PHONE service.\n"); GNUNET_CONVERSATION_phone_destroy (phone); phone = NULL; } if (NULL != id) { GNUNET_IDENTITY_disconnect (id); id = NULL; } if (NULL != qe) { GNUNET_NAMESTORE_cancel (qe); qe = NULL; } if (NULL != ns) { GNUNET_NAMESTORE_disconnect (ns); ns = NULL; } }
/** * Task run on shutdown. Cleans up everything. * * @param cls unused * @param tc scheduler context */ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != get_default) { GNUNET_IDENTITY_cancel (get_default); get_default = NULL; } if (NULL != idh) { GNUNET_IDENTITY_disconnect (idh); idh = NULL; } if (NULL != el) { GNUNET_IDENTITY_ego_lookup_cancel (el); el = NULL; } if (NULL != list_it) { GNUNET_NAMESTORE_zone_iteration_stop (list_it); list_it = NULL; } if (NULL != add_qe) { GNUNET_NAMESTORE_cancel (add_qe); add_qe = NULL; } if (NULL != add_qe_uri) { GNUNET_NAMESTORE_cancel (add_qe_uri); add_qe_uri = NULL; } if (NULL != del_qe) { GNUNET_NAMESTORE_cancel (del_qe); del_qe = NULL; } if (NULL != ns) { GNUNET_NAMESTORE_disconnect (ns); ns = NULL; } memset (&zone_pkey, 0, sizeof (zone_pkey)); if (NULL != uri) { GNUNET_free (uri); uri = NULL; } if (NULL != zm) { GNUNET_NAMESTORE_zone_monitor_stop (zm); zm = NULL; } if (NULL != data) { GNUNET_free (data); data = NULL; } }
static void do_shutdown () { if (NULL != zm) { GNUNET_NAMESTORE_zone_monitor_stop (zm); zm = NULL; } if (NULL != ns_ops[0]) { GNUNET_NAMESTORE_cancel(ns_ops[0]); ns_ops[0] = NULL; } if (NULL != ns_ops[1]) { GNUNET_NAMESTORE_cancel(ns_ops[1]); ns_ops[1] = NULL; } if (NULL != ns_ops[2]) { GNUNET_NAMESTORE_cancel(ns_ops[2]); ns_ops[2] = NULL; } if (NULL != nsh) { GNUNET_NAMESTORE_disconnect (nsh); nsh = NULL; } GNUNET_free_non_null(s_name_1); GNUNET_free_non_null(s_name_2); GNUNET_free_non_null(s_name_3); if (s_rd_1 != NULL) { GNUNET_free ((void *)s_rd_1->data); GNUNET_free (s_rd_1); } if (s_rd_2 != NULL) { GNUNET_free ((void *)s_rd_2->data); GNUNET_free (s_rd_2); } if (s_rd_3 != NULL) { GNUNET_free ((void *)s_rd_3->data); GNUNET_free (s_rd_3); } if (NULL != privkey) { GNUNET_free (privkey); privkey = NULL; } if (NULL != privkey2) { GNUNET_free (privkey2); privkey2 = NULL; } }