[gupnp] all: Fix build against Soup 3.1.2 and later



commit 1296d10eda308792d2924f141d72b8b6818878bd
Author: Jens Georg <mail jensge org>
Date:   Tue Aug 16 10:54:18 2022 +0200

    all: Fix build against Soup 3.1.2 and later

 libgupnp/gupnp-context.c        | 8 ++++++++
 libgupnp/gupnp-service-action.c | 8 +++++---
 libgupnp/gupnp-service.c        | 4 ++++
 tests/test-service.c            | 8 ++++++++
 4 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index 236c52d..1df57c5 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -1457,7 +1457,11 @@ gupnp_acl_async_callback (GUPnPAcl *acl,
         GError *error = NULL;
 
         allowed = gupnp_acl_is_allowed_finish (acl, res, &error);
+#if SOUP_CHECK_VERSION(3,1,2)
+        soup_server_message_unpause (data->message);
+#else
         soup_server_unpause_message (data->server, data->message);
+#endif
         if (!allowed)
                 soup_server_message_set_status (data->message,
                                                 SOUP_STATUS_FORBIDDEN,
@@ -1533,7 +1537,11 @@ gupnp_acl_server_handler (SoupServer *server,
                                                       query,
                                                       handler);
 
+#if SOUP_CHECK_VERSION(3,1,2)
+                        soup_server_message_pause (msg);
+#else
                         soup_server_pause_message (server, msg);
+#endif
                         // Since we drop the additional reference above, coverity seems to think this is
                         // use-after-free, but the service is still holding a reference here.
 
diff --git a/libgupnp/gupnp-service-action.c b/libgupnp/gupnp-service-action.c
index 7568093..dc1bec6 100644
--- a/libgupnp/gupnp-service-action.c
+++ b/libgupnp/gupnp-service-action.c
@@ -71,8 +71,6 @@ gupnp_service_action_get_type (void)
 static void
 finalize_action (GUPnPServiceAction *action)
 {
-        SoupServer *server;
-
         /* Embed action->response_str in a SOAP document */
         g_string_prepend (action->response_str,
                           "<?xml version=\"1.0\"?>"
@@ -125,8 +123,12 @@ finalize_action (GUPnPServiceAction *action)
                 gssdp_client_get_server_id (GSSDP_CLIENT (action->context)));
 
         /* Tell soup server that response is now ready */
-        server = gupnp_context_get_server (action->context);
+#if SOUP_CHECK_VERSION(3,1,2)
+        soup_server_message_unpause (action->msg);
+#else
+        SoupServer *server = gupnp_context_get_server (action->context);
         soup_server_unpause_message (server, action->msg);
+#endif
 
         /* Cleanup */
         gupnp_service_action_unref (action);
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 8b92df6..4620909 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -473,7 +473,11 @@ control_server_handler (SoupServer *server,
         }
 
         /* Tell soup server that response is not ready yet */
+#if SOUP_CHECK_VERSION(3,1,2)
+        soup_server_message_pause (msg);
+#else
         soup_server_pause_message (server, msg);
+#endif
 
         /* QueryStateVariable? */
         if (strcmp (action_name, "QueryStateVariable") == 0)
diff --git a/tests/test-service.c b/tests/test-service.c
index 0cf57e5..b63a903 100644
--- a/tests/test-service.c
+++ b/tests/test-service.c
@@ -36,7 +36,11 @@ on_notify (SoupServer *server,
         TestServiceNotificationCancelledData *data = user_data;
 
         // Pause message, quit mainlopp
+#if SOUP_CHECK_VERSION(3, 1, 2)
+        soup_server_message_pause (msg);
+#else
         soup_server_pause_message (server, msg);
+#endif
         data->message = msg;
         g_main_loop_quit (data->loop);
 }
@@ -144,7 +148,11 @@ test_service_notification_cancelled ()
 
         g_clear_object (&info);
 
+#if SOUP_CHECK_VERSION(3, 1, 2)
+        soup_server_message_unpause (data.message);
+#else
         soup_server_unpause_message (server, data.message);
+#endif
 
         g_main_loop_run (data.loop);
         g_clear_object (&rd);


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