static void terminate_peer (struct PeerContext *p) { if (NULL != p->ch) { GNUNET_CORE_disconnect (p->ch); p->ch = NULL; } if (NULL != p->ghh) { GNUNET_TRANSPORT_hello_get_cancel (p->ghh); p->ghh = NULL; } if (NULL != p->oh) { GNUNET_TRANSPORT_offer_hello_cancel (p->oh); p->oh = NULL; } if (NULL != p->ats_sh) { GNUNET_ATS_connectivity_suggest_cancel (p->ats_sh); p->ats_sh = NULL; } if (NULL != p->ats) { GNUNET_ATS_connectivity_done (p->ats); p->ats = NULL; } }
/** * Task run to terminate the testcase. * * @param cls NULL * @param tc unused */ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (0 != ret) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test failed at stage %u %s\n", off, (NULL != test_commands[off].label) ? test_commands[off].label : ""); if (NULL != interpreter_task) { GNUNET_SCHEDULER_cancel (interpreter_task); interpreter_task = NULL; } if (NULL != sched_ats) { GNUNET_ATS_scheduling_done (sched_ats); sched_ats = NULL; } if (NULL != con_ats) { GNUNET_ATS_connectivity_done (con_ats); con_ats = NULL; } if (NULL != perf_ats) { GNUNET_ATS_performance_done (perf_ats); perf_ats = NULL; } if (NULL != p2asd) { GNUNET_CONTAINER_multipeermap_iterate (p2asd, &free_asd, NULL); GNUNET_CONTAINER_multipeermap_destroy (p2asd); p2asd = NULL; } if (NULL != p2aid) { GNUNET_CONTAINER_multipeermap_iterate (p2aid, &free_aid, NULL); GNUNET_CONTAINER_multipeermap_destroy (p2aid); p2aid = NULL; } }
/** * Task run during shutdown. * * @param cls unused */ static void shutdown_task (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n"); shutting_down = GNUNET_YES; GCO_shutdown (); if (NULL != stats) { GNUNET_STATISTICS_destroy (stats, GNUNET_NO); stats = NULL; } if (NULL != open_ports) { GNUNET_CONTAINER_multihashmap_destroy (open_ports); open_ports = NULL; } if (NULL != loose_channels) { GNUNET_CONTAINER_multihashmap_destroy (loose_channels); loose_channels = NULL; } /* All channels, connections and CORE must be down before this point. */ GCP_destroy_all_peers (); if (NULL != peers) { GNUNET_CONTAINER_multipeermap_destroy (peers); peers = NULL; } if (NULL != connections) { GNUNET_CONTAINER_multishortmap_destroy (connections); connections = NULL; } if (NULL != ats_ch) { GNUNET_ATS_connectivity_done (ats_ch); ats_ch = NULL; } GCD_shutdown (); GCH_shutdown (); GNUNET_free_non_null (my_private_key); my_private_key = NULL; }
static void terminate_peer (struct PeerContext *p) { if (p->nth != NULL) { GNUNET_CORE_notify_transmit_ready_cancel (p->nth); p->nth = NULL; } if (NULL != p->ch) { GNUNET_CORE_disconnect (p->ch); p->ch = NULL; } if (NULL != p->th) { GNUNET_TRANSPORT_get_hello_cancel (p->ghh); GNUNET_TRANSPORT_disconnect (p->th); p->th = NULL; } if (NULL != p->ats_sh) { GNUNET_ATS_connectivity_suggest_cancel (p->ats_sh); p->ats_sh = NULL; } if (NULL != p->ats) { GNUNET_ATS_connectivity_done (p->ats); p->ats = NULL; } if (NULL != p->stats) { GNUNET_STATISTICS_destroy (p->stats, GNUNET_NO); p->stats = NULL; } if (NULL != p->hello) { GNUNET_free (p->hello); p->hello = NULL; } }
/** * Last task run during shutdown. Disconnects us from * the transport and core. * * @param cls unused, NULL */ static void cleaning_task (void *cls) { if (NULL != peerinfo_notify) { GNUNET_PEERINFO_notify_cancel (peerinfo_notify); peerinfo_notify = NULL; } if (NULL != handle) { GNUNET_CORE_disconnect (handle); handle = NULL; } whitelist_peers (); if (NULL != add_task) { GNUNET_SCHEDULER_cancel (add_task); add_task = NULL; } if (NULL != oh) { GNUNET_TRANSPORT_offer_hello_cancel (oh); oh = NULL; } GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); GNUNET_CONTAINER_multipeermap_destroy (peers); peers = NULL; if (NULL != ats) { GNUNET_ATS_connectivity_done (ats); ats = NULL; } if (NULL != stats) { GNUNET_STATISTICS_destroy (stats, GNUNET_NO); stats = NULL; } }
/** * Function called when the service shuts down. Unloads our plugins * and cancels pending validations. * * @param cls closure, unused * @param tc task context (unused) */ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GST_neighbours_stop (); GST_plugins_unload (); GST_validation_stop (); GST_ats_done (); GNUNET_ATS_scheduling_done (GST_ats); GST_ats = NULL; GNUNET_ATS_connectivity_done (GST_ats_connect); GST_ats_connect = NULL; GNUNET_ATS_scanner_done (GST_is); GST_is = NULL; GST_clients_stop (); GST_blacklist_stop (); GST_hello_stop (); GST_manipulation_stop (); if (NULL != GST_peerinfo) { GNUNET_PEERINFO_disconnect (GST_peerinfo); GST_peerinfo = NULL; } if (NULL != GST_stats) { GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO); GST_stats = NULL; } if (NULL != GST_my_private_key) { GNUNET_free(GST_my_private_key); GST_my_private_key = NULL; } GST_server = NULL; }