[gssdp/gssdp_1.0] tests: Smarter detection of 127.0.0.1 interface



commit 3f2c58787236dbf46162ad9cb35a774d54acf008
Author: Jens Georg <mail jensge org>
Date:   Sun Jul 5 14:39:57 2020 +0200

    tests: Smarter detection of 127.0.0.1 interface

 tests/test-util.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/tests/test-util.c b/tests/test-util.c
index e53546a..ddb273b 100644
--- a/tests/test-util.c
+++ b/tests/test-util.c
@@ -66,21 +66,17 @@ get_client (GError **outer_error)
 
                 g_debug ("Detecting network interface to use for tests...");
 
-                client = gssdp_client_new (NULL, "lo", &error);
+                client = g_initable_new (GSSDP_TYPE_CLIENT,
+                                         NULL,
+                                         &error,
+                                         "host-ip", "127.0.0.1",
+                                         NULL);
                 if (error == NULL) {
-                        g_debug ("Using lo");
-                        device = g_strdup ("lo");
+                        device = g_strdup (gssdp_client_get_interface (client));
+                        g_debug ("Using %s", device);
                         g_object_unref (client);
                 } else {
-                        g_clear_error(&error);
-                        client = gssdp_client_new (NULL, "lo0", &error);
-                        if (error == NULL) {
-                                g_debug ("Using lo0");
-                                device = g_strdup ("lo0");
-                                g_object_unref (client);
-                        } else {
-                                g_debug ("Using default interface, expect fails");
-                        }
+                        g_debug ("Using default interface, expect fails");
                 }
                 g_once_init_leave (&init_guard, 1);
         }


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