static void clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_SERVER_destroy (server); server = NULL; GNUNET_CONFIGURATION_destroy (cfg); cfg = NULL; }
static void finish_up (void *cls) { GNUNET_assert (ok == 5); ok = 0; GNUNET_SERVER_destroy (server); GNUNET_MQ_destroy (mq); GNUNET_CONFIGURATION_destroy (cfg); }
static void finish_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_assert (ok == 5); ok = 0; GNUNET_SERVER_destroy (server); GNUNET_CLIENT_disconnect (cc); GNUNET_CONFIGURATION_destroy (cfg); }
/** * Task run during shutdown. Stops the server/service. * * @param cls the `struct GNUNET_SERVICE_Context` */ static void shutdown_task (void *cls) { struct GNUNET_SERVICE_Context *service = cls; struct GNUNET_SERVER_Handle *server = service->server; service->shutdown_task = NULL; if (0 != (service->options & GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN)) GNUNET_SERVER_stop_listening (server); else GNUNET_SERVER_destroy (server); }
/** * We are done with everything. Stop remaining * tasks, signal handler and the server. */ static void do_shutdown () { if (NULL != server) { GNUNET_SERVER_destroy (server); server = NULL; } if (GNUNET_SCHEDULER_NO_TASK != child_death_task) { GNUNET_SCHEDULER_cancel (child_death_task); child_death_task = GNUNET_SCHEDULER_NO_TASK; } }
/** * Stop a service that was started with "GNUNET_SERVICE_start". * * @param sctx the service context returned from the start function */ void GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) { unsigned int i; #if HAVE_MALLINFO { char *counter; if ( (GNUNET_YES == GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, "GAUGER_HEAP")) && (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (sctx->cfg, sctx->service_name, "GAUGER_HEAP", &counter)) ) { struct mallinfo mi; mi = mallinfo (); GAUGER (sctx->service_name, counter, mi.usmblks, "blocks"); GNUNET_free (counter); } } #endif if (NULL != sctx->shutdown_task) { GNUNET_SCHEDULER_cancel (sctx->shutdown_task); sctx->shutdown_task = NULL; } if (NULL != sctx->server) GNUNET_SERVER_destroy (sctx->server); GNUNET_free_non_null (sctx->my_handlers); if (NULL != sctx->addrs) { i = 0; while (NULL != sctx->addrs[i]) GNUNET_free (sctx->addrs[i++]); GNUNET_free (sctx->addrs); } GNUNET_free_non_null (sctx->addrlens); GNUNET_free_non_null (sctx->v4_denied); GNUNET_free_non_null (sctx->v6_denied); GNUNET_free_non_null (sctx->v4_allowed); GNUNET_free_non_null (sctx->v6_allowed); GNUNET_free (sctx); }
static void recv_bounce (void *cls, const struct GNUNET_MessageHeader *got) { int *ok = cls; struct GNUNET_MessageHeader msg; GNUNET_assert (got != NULL); /* timeout */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving bounce, checking content\n"); msg.type = htons (MY_TYPE); msg.size = htons (sizeof (struct GNUNET_MessageHeader)); GNUNET_assert (0 == memcmp (got, &msg, sizeof (struct GNUNET_MessageHeader))); GNUNET_CLIENT_disconnect (client); client = NULL; GNUNET_SERVER_destroy (server); server = NULL; *ok = 0; }
/** * Task run during shutdown. * * @param cls unused * @param tc scheduler context */ static void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_SERVER_destroy (server); server = NULL; }