[gupnp] service-proxy: Fix endless loop on early notify



commit 26259bd31d4b77867e102b8d81030cfe671e6378
Author: Jens Georg <mail jensge org>
Date:   Mon May 27 21:21:06 2019 +0200

    service-proxy: Fix endless loop on early notify
    
    According to UDA, the service has to send the initial event AFTER making
    sure that the SUBSCRIBE call is returned.
    
    Some devices, such as the media server in Fritz OS 6 or IGD in D-Link
    DIR 635 send the initial event state BEFORE sending the answer to
    subscibe. If that happens, just ignore the event.
    
    Fixes #8

 libgupnp/gupnp-service-proxy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 7a83705..38ff46a 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -1606,9 +1606,10 @@ server_handler (G_GNUC_UNUSED SoupServer        *soup_server,
                 return;
         }
 
+        priv = gupnp_service_proxy_get_instance_private (proxy);
         /* Get root propertyset element */
         node = xmlDocGetRootElement (doc);
-        if (node == NULL || strcmp ((char *) node->name, "propertyset")) {
+        if (node == NULL || strcmp ((char *) node->name, "propertyset") || priv->sid == NULL) {
                 /* Empty or unsupported */
                 xmlFreeDoc (doc);
 
@@ -1624,7 +1625,6 @@ server_handler (G_GNUC_UNUSED SoupServer        *soup_server,
          */
         emit_notify_data = emit_notify_data_new (hdr, seq, doc);
 
-        priv = gupnp_service_proxy_get_instance_private (proxy);
         priv->pending_notifies =
                 g_list_append (priv->pending_notifies, emit_notify_data);
         if (!priv->notify_idle_src) {


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