[gssdp/gssdp_1.0] socket-source: Set multicast sending interface



commit 023a5dd53806da295fe3a73a807a5767ed70f9d2
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 | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/libgssdp/gssdp-socket-source.c b/libgssdp/gssdp-socket-source.c
index 79e3d83..dcd9a32 100644
--- a/libgssdp/gssdp-socket-source.c
+++ b/libgssdp/gssdp-socket-source.c
@@ -235,16 +235,6 @@ gssdp_socket_source_do_init (GInitable                   *initable,
                 /* Enable multicast loopback */
                 g_socket_set_multicast_loopback (self->priv->socket, TRUE);
 
-                if (!gssdp_socket_mcast_interface_set (self->priv->socket,
-                                                       iface_address,
-                                                       &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 (iface_address,
@@ -256,6 +246,17 @@ gssdp_socket_source_do_init (GInitable                   *initable,
         } else {
                 guint port = SSDP_PORT;
 
+                if (!gssdp_socket_mcast_interface_set (self->priv->socket,
+                                                       iface_address,
+                                                       &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 (self->priv->type == GSSDP_SOCKET_SOURCE_TYPE_SEARCH)


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