[gssdp] socket-source: Set multicast sending interface



commit a8ea4e504760737fde8b5930961bf0d126299a2e
Author: Jens Georg <mail jensge org>
Date:   Thu Jan 2 12:28:45 2020 +0100

    socket-source: Set multicast sending interface
    
    The interface was set on the receiving socket, not the sending sockets
    
    Fixes #4

 libgssdp/gssdp-socket-source.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/libgssdp/gssdp-socket-source.c b/libgssdp/gssdp-socket-source.c
index 87f8b7a..3dafc78 100644
--- a/libgssdp/gssdp-socket-source.c
+++ b/libgssdp/gssdp-socket-source.c
@@ -257,17 +257,6 @@ gssdp_socket_source_do_init (GInitable                   *initable,
                 /* Enable multicast loopback */
                 g_socket_set_multicast_loopback (priv->socket, TRUE);
 
-                if (!gssdp_socket_mcast_interface_set (priv->socket,
-                                                       priv->address,
-                                                       (guint32) priv->index,
-                                                       &inner_error)) {
-                        g_propagate_prefixed_error (
-                                        error,
-                                        inner_error,
-                                        "Failed to set multicast interface");
-
-                        goto error;
-                }
 
 #ifdef G_OS_WIN32
                 bind_address = g_inet_socket_address_new (priv->address,
@@ -282,6 +271,18 @@ gssdp_socket_source_do_init (GInitable                   *initable,
         } else {
                 guint port = SSDP_PORT;
 
+                if (!gssdp_socket_mcast_interface_set (priv->socket,
+                                                       priv->address,
+                                                       (guint32) priv->index,
+                                                       &inner_error)) {
+                        g_propagate_prefixed_error (
+                                        error,
+                                        inner_error,
+                                        "Failed to set multicast interface");
+
+                        goto error;
+                }
+
                 /* Use user-supplied or random port for the socket source used
                  * by M-SEARCH */
                 if (priv->type == GSSDP_SOCKET_SOURCE_TYPE_SEARCH)


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