[gupnp] if introspection fails on setup, call call-back through idle
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] if introspection fails on setup, call call-back through idle
- Date: Thu, 24 Oct 2019 19:40:31 +0000 (UTC)
commit 07b51bcabfa38d803fcf3623ba04c0f13512b38e
Author: Jens Georg <mail jensge org>
Date: Sat Sep 21 21:11:22 2019 +0200
if introspection fails on setup, call call-back through idle
libgupnp/gupnp-service-info.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/libgupnp/gupnp-service-info.c b/libgupnp/gupnp-service-info.c
index ef39652..b531784 100644
--- a/libgupnp/gupnp-service-info.c
+++ b/libgupnp/gupnp-service-info.c
@@ -85,6 +85,7 @@ typedef struct {
gulong cancelled_id;
SoupMessage *message;
+ GError *error;
} GetSCPDURLData;
static void
@@ -672,6 +673,18 @@ cancellable_cancelled_cb (GCancellable *cancellable,
get_scpd_url_data_free (data);
}
+static gboolean
+introspection_error_cb (gpointer user_data)
+{
+ GetSCPDURLData *data = (GetSCPDURLData *)user_data;
+
+ data->callback (data->info, NULL, data->error, data->user_data);
+ g_error_free (data->error);
+ g_slice_free (GetSCPDURLData, data);
+
+ return FALSE;
+}
+
/**
* gupnp_service_info_get_introspection_async:
* @info: A #GUPnPServiceInfo
@@ -744,26 +757,32 @@ gupnp_service_info_get_introspection_async_full
g_free (local_scpd_url);
}
+ data->info = info;
+ data->callback = callback;
+ data->user_data = user_data;
+
if (data->message == NULL) {
GError *error;
+ GSource *idle_source;
error = g_error_new
(GUPNP_SERVER_ERROR,
GUPNP_SERVER_ERROR_INVALID_URL,
"No valid SCPD URL defined");
+ data->error = error;
- callback (info, NULL, error, user_data);
-
- g_error_free (error);
+ idle_source = g_idle_source_new ();
+ g_source_set_callback (idle_source,
+ introspection_error_cb,
+ data, NULL);
+ g_source_attach (idle_source,
+ g_main_context_get_thread_default ());
- g_slice_free (GetSCPDURLData, data);
+ return;
return;
}
- data->info = info;
- data->callback = callback;
- data->user_data = user_data;
/* Send off the message */
priv = gupnp_service_info_get_instance_private (info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]