summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2022-03-28 10:56:58 +0200
committerJens Georg <mail@jensge.org>2022-03-28 11:26:42 +0200
commitb058d9843b15e3ab3b77b4acc4d72f3ffb332578 (patch)
tree9c4711432a35d53a7e8823565ef486d51e621e8f
parent40fd188752d5dc25cd44a634e78c7041446a0140 (diff)
downloadgupnp-tools-b058d9843b15e3ab3b77b4acc4d72f3ffb332578.tar.gz
all: Fix inconsistency regarding action errors
The current async api is a bit weird, you need try to get results from the action to capture SOAP errors
-rw-r--r--src/av-cp/renderer-controls.c26
-rw-r--r--src/network-light/upnp.c13
-rw-r--r--src/upload/transfer.c11
3 files changed, 39 insertions, 11 deletions
diff --git a/src/av-cp/renderer-controls.c b/src/av-cp/renderer-controls.c
index e1250e7..3e03b03 100644
--- a/src/av-cp/renderer-controls.c
+++ b/src/av-cp/renderer-controls.c
@@ -221,10 +221,18 @@ set_av_transport_uri_cb (GObject *object, GAsyncResult *res, gpointer user_data)
udn = gupnp_service_info_get_udn (GUPNP_SERVICE_INFO (object));
- gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (object),
- res,
- &error);
-
+ GUPnPServiceProxyAction *action;
+ action = gupnp_service_proxy_call_action_finish (
+ GUPNP_SERVICE_PROXY (object),
+ res,
+ &error);
+
+ // The above call will only catch issues with the HTTP transport, not
+ // with the call itself. So we need to call an empty get on the action
+ // as well to get any SOAP error
+ if (error == NULL) {
+ gupnp_service_proxy_action_get_result (action, &error, NULL);
+ }
if (error != NULL) {
g_warning ("Failed to set URI '%s' on %s: %s",
gupnp_didl_lite_resource_get_uri (data->resource),
@@ -707,9 +715,17 @@ set_volume_cb (GObject *object, GAsyncResult *res, gpointer user_data)
{
GError *error;
GUPnPServiceProxy *proxy = GUPNP_SERVICE_PROXY (object);
+ GUPnPServiceProxyAction *action;
error = NULL;
- if (!gupnp_service_proxy_call_action_finish (proxy, res, &error)) {
+ action = gupnp_service_proxy_call_action_finish (proxy, res, &error);
+
+ if (error == NULL) {
+ // No transport error, check for SOAP error
+ gupnp_service_proxy_action_get_result (action, &error, NULL);
+ }
+
+ if (error != NULL) {
const char *udn;
udn = gupnp_service_info_get_udn (GUPNP_SERVICE_INFO (object));
diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c
index 1536d6c..f02b077 100644
--- a/src/network-light/upnp.c
+++ b/src/network-light/upnp.c
@@ -440,10 +440,17 @@ on_service_proxy_action_ret (GObject *object,
gpointer user_data)
{
GError *error = NULL;
+ GUPnPServiceProxyAction *action;
- gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (object),
- result,
- &error);
+ action = gupnp_service_proxy_call_action_finish (
+ GUPNP_SERVICE_PROXY (object),
+ result,
+ &error);
+
+ if (error == NULL) {
+ // Check for SOAP transport error
+ gupnp_service_proxy_action_get_result (action, &error, NULL);
+ }
if (error != NULL) {
GUPnPServiceInfo *info = GUPNP_SERVICE_INFO (object);
diff --git a/src/upload/transfer.c b/src/upload/transfer.c
index d493a3b..64e645b 100644
--- a/src/upload/transfer.c
+++ b/src/upload/transfer.c
@@ -44,15 +44,20 @@ get_transfer_progress_cb (GObject *object,
TrackTransferData *data;
guint64 total, length;
gchar *status;
+ GUPnPServiceProxyAction *action;
data = (TrackTransferData *) user_data;
error = NULL;
total = length = 0;
status = NULL;
- gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (object),
- result,
- &error);
+ action = gupnp_service_proxy_call_action_finish (
+ GUPNP_SERVICE_PROXY (object),
+ result,
+ &error);
+ if (error == NULL) {
+ gupnp_service_proxy_action_get_result (action, &error, NULL);
+ }
if (error != NULL) {
g_critical ("Failed to track file transfer: %s",
error->message);