[gupnp/wip/ipv6-behavior-alignment: 3/3] Connman: Entertain both address families
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/wip/ipv6-behavior-alignment: 3/3] Connman: Entertain both address families
- Date: Thu, 4 Aug 2022 17:48:39 +0000 (UTC)
commit 8471bb3dc50162a10a801c37b66b332f0d4e8ad5
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]