+/**
+ * Function called when the service shuts down. Unloads our plugins.
+ *
+ * @param cls closure, unused
+ * @param tc task context (unused)
+ */
+static void
+unload_plugins (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct TransportPlugin *plug;
+ struct AddressList *al;
+
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transport service is unloading plugins...\n");
+#endif
+ while (NULL != (plug = plugins))
+ {
+ plugins = plug->next;
+ GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
+ GNUNET_free (plug->lib_name);
+ GNUNET_free (plug->short_name);
+ while (NULL != (al = plug->addresses))
+ {
+ plug->addresses = al->next;
+ GNUNET_free (al);
+ }
+ GNUNET_free (plug);
+ }
+ if (my_private_key != NULL)
+ GNUNET_CRYPTO_rsa_key_free (my_private_key);
+ GNUNET_free_non_null (our_hello);
+}
+
+