static void on_index_modules (GObject *source_object, GAsyncResult *result, gpointer user_data) { CockpitWebResponse *response = user_data; CockpitWebService *service = COCKPIT_WEB_SERVICE (source_object); JsonObject *modules; /* Failures printed elsewhere */ modules = cockpit_web_service_modules_finish (service, result); send_index_response (response, service, modules); if (modules) json_object_unref (modules); g_object_unref (response); }
static void cockpit_web_service_finalize (GObject *object) { CockpitWebService *self = COCKPIT_WEB_SERVICE (object); cockpit_sockets_cleanup (&self->sockets); if (self->transport) g_object_unref (self->transport); g_bytes_unref (self->control_prefix); cockpit_creds_unref (self->creds); if (self->ping_timeout) g_source_remove (self->ping_timeout); g_hash_table_destroy (self->host_by_checksum); g_hash_table_destroy (self->checksum_by_host); G_OBJECT_CLASS (cockpit_web_service_parent_class)->finalize (object); }
static void on_login_modules (GObject *source, GAsyncResult *result, gpointer user_data) { LoginResponse *lr = user_data; CockpitWebService *service; JsonObject *modules; GBytes *content; service = COCKPIT_WEB_SERVICE (source); modules = cockpit_web_service_modules_finish (service, result); content = build_environment (service, modules); g_hash_table_replace (lr->headers, g_strdup ("Content-Type"), g_strdup ("application/json")); cockpit_web_response_content (lr->response, lr->headers, content, NULL); g_bytes_unref (content); if (modules) json_object_unref (modules); }
static void cockpit_web_service_dispose (GObject *object) { CockpitWebService *self = COCKPIT_WEB_SERVICE (object); gboolean emit = FALSE; if (self->control_sig) g_signal_handler_disconnect (self->transport, self->control_sig); self->control_sig = 0; if (self->recv_sig) g_signal_handler_disconnect (self->transport, self->recv_sig); self->recv_sig = 0; if (self->closed_sig) g_signal_handler_disconnect (self->transport, self->closed_sig); self->closed_sig = 0; if (!self->sent_done) { self->sent_done = TRUE; cockpit_transport_close (self->transport, NULL); } if (!self->closing) { g_debug ("web service closing"); emit = TRUE; } self->closing = TRUE; cockpit_sockets_close (&self->sockets, NULL); if (emit) g_signal_emit (self, sig_destroy, 0); G_OBJECT_CLASS (cockpit_web_service_parent_class)->dispose (object); }