[gupnp/gupnp-1.4] ServiceProxy: Handle Cancelled properly



commit f0306e44cbfcde21067efd02cdbc7be7e9587326
Author: Jens Georg <mail jensge org>
Date:   Sun Jan 9 11:30:52 2022 +0100

    ServiceProxy: Handle Cancelled properly
    
    Cancelled is a transport error, so we have to handle that first.
    Also fix the reason phrase for transport errors

 libgupnp/gupnp-service-proxy.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 3d34cec..e40fd47 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -746,18 +746,18 @@ action_task_got_response (SoupSession *session,
                 action->cancellable_connection_id = 0;
         }
 
-        if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) {
-                g_task_return_new_error (
-                        task,
-                        GUPNP_SERVER_ERROR,
-                        GUPNP_SERVER_ERROR_OTHER,
-                        "Server does not allow any POST messages");
-        } else if (msg->status_code == SOUP_STATUS_CANCELLED) {
+        if (msg->status_code == SOUP_STATUS_CANCELLED) {
                 g_task_return_new_error (task,
                                          G_IO_ERROR,
                                          G_IO_ERROR_CANCELLED,
                                          "Action message was cancelled");
-        } else {
+        } else if (SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code)) {
+                g_task_return_new_error (task,
+                                         GUPNP_SERVER_ERROR,
+                                         GUPNP_SERVER_ERROR_OTHER,
+                                         "%s",
+                                         msg->reason_phrase);
+        } else  {
                 g_task_return_pointer (task,
                                        g_task_get_task_data (task),
                                        NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]