[gssdp] client: Add fall-back for socket family



commit 63423c944484ae992b2d8e3ff34dcb30ce521a38
Author: Jens Georg <mail jensge org>
Date:   Tue Jan 15 10:20:44 2019 +0100

    client: Add fall-back for socket family
    
    If no socket family was specified, fall-back to IPv4
    
    Fix generation of default server id as well to be done after
    setting the UDA version fallback

 libgssdp/gssdp-client.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index e7cc3fe..f9c8d3e 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -174,8 +174,6 @@ gssdp_client_init (GSSDPClient *client)
 
         priv->active = TRUE;
 
-        /* Generate default server ID */
-        priv->server_id = make_server_id (gssdp_client_get_uda_version (client));
 }
 
 static void
@@ -198,11 +196,24 @@ gssdp_client_initable_init (GInitable                   *initable,
         if (priv->initialized)
                 return TRUE;
 
+        /* The following two fall-backs are there to make things
+         * compatible with GSSDP 1.0.x and earlier */
+
         /* Fall-back to UDA 1.0 if no version is specified */
         if (priv->uda_version == GSSDP_UDA_VERSION_UNSPECIFIED) {
                 priv->uda_version = GSSDP_UDA_VERSION_1_0;
         }
 
+        /* Fall-back to IPv4 if no socket family was specified */
+        if (priv->device.address_family == G_SOCKET_FAMILY_INVALID) {
+                priv->device.address_family = G_SOCKET_FAMILY_IPV4;
+        }
+
+        /* Generate default server ID */
+        if (priv->server_id != NULL) {
+                priv->server_id = make_server_id (gssdp_client_get_uda_version (client));
+        }
+
         if (!gssdp_net_init (error))
                 return FALSE;
 


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