[gupnp] Connman: Entertain both address families
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] Connman: Entertain both address families
- Date: Sun, 7 Aug 2022 17:55:10 +0000 (UTC)
commit 083e9f17d28df9591437bd8de8f35d47f07a8f80
Author: Jens Georg <mail jensge org>
Date: Thu Aug 4 19:47:49 2022 +0200
Connman: Entertain both address families
libgupnp/gupnp-connman-manager.c | 72 ++++++++++++++++++++++++++++++----------
1 file changed, 54 insertions(+), 18 deletions(-)
---
diff --git a/libgupnp/gupnp-connman-manager.c b/libgupnp/gupnp-connman-manager.c
index 5e20bfe..de6d903 100644
--- a/libgupnp/gupnp-connman-manager.c
+++ b/libgupnp/gupnp-connman-manager.c
@@ -93,28 +93,64 @@ loopback_context_create (gpointer data)
g_object_get (manager, "port", &port, NULL);
- context = g_initable_new (GUPNP_TYPE_CONTEXT,
- NULL,
- &error,
- "interface",
- LOOPBACK_IFACE,
- "port",
- port,
- "address-family",
- gupnp_context_manager_get_socket_family (
- GUPNP_CONTEXT_MANAGER (manager)),
- NULL);
+ GSocketFamily family = gupnp_context_manager_get_socket_family (
+ GUPNP_CONTEXT_MANAGER (manager));
+
+ if (family == G_SOCKET_FAMILY_INVALID ||
+ family == G_SOCKET_FAMILY_IPV4) {
+ GInetAddress *addr =
+ g_inet_address_new_loopback (G_SOCKET_FAMILY_IPV4);
+
+ context = g_initable_new (GUPNP_TYPE_CONTEXT,
+ NULL,
+ &error,
+ "address",
+ addr,
+ "port",
+ port,
+ NULL);
+ if (error) {
+ g_warning ("Error creating GUPnP context: %s\n",
+ error->message);
+
+ g_clear_error (&error);
+ } else {
+ g_signal_emit_by_name (manager,
+ "context-available",
+ context);
+ }
- if (error != NULL) {
- g_warning ("Error creating GUPnP context: %s", error->message);
- g_error_free (error);
+ g_object_unref (context);
+ g_object_unref (addr);
+ }
+
+ if (family == G_SOCKET_FAMILY_INVALID ||
+ family == G_SOCKET_FAMILY_IPV6) {
+ GInetAddress *addr =
+ g_inet_address_new_loopback (G_SOCKET_FAMILY_IPV6);
+ context = g_initable_new (GUPNP_TYPE_CONTEXT,
+ NULL,
+ &error,
+ "address",
+ addr,
+ "port",
+ port,
+ NULL);
+ if (error) {
+ g_warning ("Error creating GUPnP context: %s\n",
+ error->message);
+
+ g_clear_error (&error);
+ } else {
+ g_signal_emit_by_name (manager,
+ "context-available",
+ context);
+ }
- return FALSE;
+ g_object_unref (context);
+ g_object_unref (addr);
}
- g_signal_emit_by_name (manager, "context-available", context);
- g_object_unref (context);
-
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]