Accepting request 1074264 from GNOME:Next
OBS-URL: https://build.opensuse.org/request/show/1074264 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gupnp-igd?expand=0&rev=56
This commit is contained in:
parent
c63af315c5
commit
4694e18824
83
2c413bbd8b9afc41648f21ad173f0caf81a5f98b.patch
Normal file
83
2c413bbd8b9afc41648f21ad173f0caf81a5f98b.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From 2c413bbd8b9afc41648f21ad173f0caf81a5f98b Mon Sep 17 00:00:00 2001
|
||||
From: Jens Georg <mail@jensge.org>
|
||||
Date: Thu, 13 Jan 2022 07:40:09 +0100
|
||||
Subject: [PATCH] Test: Interact with service in its context
|
||||
|
||||
Otherwise it there is a data race in notification handling since GUPnP
|
||||
instances are not safe to be used from multiple threads at the same time.
|
||||
---
|
||||
tests/gtest/gupnp-simple-igd.c | 37 +++++++++++++++++++++++++---------
|
||||
1 file changed, 28 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/tests/gtest/gupnp-simple-igd.c b/tests/gtest/gupnp-simple-igd.c
|
||||
index 6e62fea..4e689ef 100644
|
||||
--- a/tests/gtest/gupnp-simple-igd.c
|
||||
+++ b/tests/gtest/gupnp-simple-igd.c
|
||||
@@ -182,12 +182,28 @@ delete_port_mapping_cb (GUPnPService *service,
|
||||
g_source_attach (src, g_main_context_get_thread_default ());
|
||||
}
|
||||
|
||||
+typedef struct _MappedData {
|
||||
+ GMainContext *context;
|
||||
+ const char *ip_address;
|
||||
+ guint port;
|
||||
+} MappedData;
|
||||
+
|
||||
+gboolean service_notify (gpointer user_data) {
|
||||
+ MappedData *d = (MappedData *) user_data;
|
||||
+ gupnp_service_notify (GUPNP_SERVICE (ipservice),
|
||||
+ "ExternalIPAddress", G_TYPE_STRING, d->ip_address, NULL);
|
||||
+
|
||||
+ return G_SOURCE_REMOVE;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
mapped_external_port_cb (GUPnPSimpleIgd *igd, gchar *proto,
|
||||
gchar *external_ip, gchar *replaces_external_ip, guint external_port,
|
||||
gchar *local_ip, guint local_port, gchar *description, gpointer user_data)
|
||||
{
|
||||
- guint requested_external_port = GPOINTER_TO_UINT (user_data);
|
||||
+
|
||||
+ MappedData *d = (MappedData *) user_data;
|
||||
+ guint requested_external_port = d->port;
|
||||
|
||||
g_assert (invalid_ip == NULL);
|
||||
|
||||
@@ -218,13 +234,13 @@ mapped_external_port_cb (GUPnPSimpleIgd *igd, gchar *proto,
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!strcmp (external_ip, IP_ADDRESS_FIRST))
|
||||
- gupnp_service_notify (GUPNP_SERVICE (ipservice),
|
||||
- "ExternalIPAddress", G_TYPE_STRING, IP_ADDRESS_SECOND, NULL);
|
||||
- else if (!strcmp (external_ip, PPP_ADDRESS_FIRST))
|
||||
- gupnp_service_notify (GUPNP_SERVICE (pppservice),
|
||||
- "ExternalIPAddress", G_TYPE_STRING, PPP_ADDRESS_SECOND, NULL);
|
||||
- else
|
||||
+ if (!strcmp (external_ip, IP_ADDRESS_FIRST)) {
|
||||
+ d->ip_address = IP_ADDRESS_SECOND;
|
||||
+ g_main_context_invoke(d->context, service_notify, d);
|
||||
+ } else if (!strcmp (external_ip, PPP_ADDRESS_FIRST)) {
|
||||
+ d->ip_address = PPP_ADDRESS_SECOND;
|
||||
+ g_main_context_invoke(d->context, service_notify, d);
|
||||
+ } else
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
@@ -333,9 +349,12 @@ run_gupnp_simple_igd_test (GMainContext *mainctx, GUPnPSimpleIgd *igd,
|
||||
|
||||
gupnp_root_device_set_available (dev, TRUE);
|
||||
|
||||
+ MappedData d;
|
||||
+ d.context = mainctx;
|
||||
+ d.port = requested_port;
|
||||
|
||||
g_signal_connect (igd, "mapped-external-port",
|
||||
- G_CALLBACK (mapped_external_port_cb), GUINT_TO_POINTER (requested_port));
|
||||
+ G_CALLBACK (mapped_external_port_cb), &d);
|
||||
g_signal_connect (igd, "error-mapping-port",
|
||||
G_CALLBACK (error_mapping_port_cb), NULL);
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
32
bbe36b279e247cd8ec4ab00bcdf02178af8a99af.patch
Normal file
32
bbe36b279e247cd8ec4ab00bcdf02178af8a99af.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From bbe36b279e247cd8ec4ab00bcdf02178af8a99af Mon Sep 17 00:00:00 2001
|
||||
From: Jens Georg <mail@jensge.org>
|
||||
Date: Thu, 13 Jan 2022 07:42:31 +0100
|
||||
Subject: [PATCH] Remove obsolete host_path in test
|
||||
|
||||
gupnp_root_device_new will do this automatically, actually does for
|
||||
quite some time now (pre 1.0)
|
||||
---
|
||||
tests/gtest/gupnp-simple-igd.c | 7 -------
|
||||
1 file changed, 7 deletions(-)
|
||||
|
||||
diff --git a/tests/gtest/gupnp-simple-igd.c b/tests/gtest/gupnp-simple-igd.c
|
||||
index 4e689ef..593c46e 100644
|
||||
--- a/tests/gtest/gupnp-simple-igd.c
|
||||
+++ b/tests/gtest/gupnp-simple-igd.c
|
||||
@@ -302,13 +302,6 @@ run_gupnp_simple_igd_test (GMainContext *mainctx, GUPnPSimpleIgd *igd,
|
||||
if (g_getenv ("XML_PATH"))
|
||||
xml_path = g_getenv ("XML_PATH");
|
||||
|
||||
- gupnp_context_host_path (context, xml_path, "");
|
||||
-
|
||||
- /*
|
||||
- gupnp_context_host_path (context, "InternetGatewayDevice.xml", "/InternetGatewayDevice.xml");
|
||||
- gupnp_context_host_path (context, "WANIPConnection.xml", "/WANIPConnection.xml");
|
||||
- gupnp_context_host_path (context, "WANPPPConnection.xml", "/WANPPPConnection.xml");
|
||||
- */
|
||||
|
||||
dev = gupnp_root_device_new (context, "InternetGatewayDevice.xml", xml_path, &error);
|
||||
g_assert (dev);
|
||||
--
|
||||
GitLab
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 24 10:19:09 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Add upstream patches to hopefully fix racy tests:
|
||||
+ 2c413bbd8b9afc41648f21ad173f0caf81a5f98b.patch
|
||||
+ bbe36b279e247cd8ec4ab00bcdf02178af8a99af.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 3 09:06:37 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
|
@ -29,6 +29,10 @@ Source1: baselibs.conf
|
||||
Patch0: 79a1e4cf8c256132978a1d8ab718c8ad132386de.patch
|
||||
# PATCH-FIX-UPSTREAM fa1546614190942ab266832e7470a6debf8c32cb.patch -- test: Port to g_inet_address_new_loopback
|
||||
Patch1: fa1546614190942ab266832e7470a6debf8c32cb.patch
|
||||
# PATCH-FIX-UPSTREAM 2c413bbd8b9afc41648f21ad173f0caf81a5f98b.patch -- Test: Interact with service in its context
|
||||
Patch2: 2c413bbd8b9afc41648f21ad173f0caf81a5f98b.patch
|
||||
# PATCH-FIX-UPSTREAM bbe36b279e247cd8ec4ab00bcdf02178af8a99af.patch -- Remove obsolete host_path in test
|
||||
Patch3: bbe36b279e247cd8ec4ab00bcdf02178af8a99af.patch
|
||||
|
||||
BuildRequires: gtk-doc
|
||||
BuildRequires: meson
|
||||
|
Loading…
Reference in New Issue
Block a user