[gupnp] Do not try to reuse message on error



commit 00a73ff7d5fb4e78ce195947b3ace7c998b2d31e
Author: Jens Georg <mail jensge org>
Date:   Sat Aug 17 15:40:19 2013 +0200

    Do not try to reuse message on error
    
    If one of the call-backs has an error, just recreate the soup message. If we
    want to re-use the old soup message we need to get the reference counting
    right etc. This could lead to cases where notifications were not sent properly
    because the first URL was failing and the requeuing failed as well.
    
    Also it caused crashes by leaving a dangling pointer in pending_messages.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703263

 libgupnp/gupnp-service.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 459ed77..684dbd1 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -1840,23 +1840,20 @@ notify_got_response (G_GNUC_UNUSED SoupSession *session,
         } else {
                 /* Other failure: Try next callback or signal failure. */
                 if (data->callbacks->next) {
-                        SoupURI *uri;
-                        SoupSession *service_session;
+                        SoupBuffer *buffer;
+                        guint8 *property_set;
+                        gsize length;
 
                         /* Call next callback */
                         data->callbacks = data->callbacks->next;
 
-                        uri = soup_uri_new (data->callbacks->data);
-                        soup_message_set_uri (msg, uri);
-                        soup_uri_free (uri);
-
-                        /* And re-queue */
-                        data->pending_messages = 
-                                g_list_prepend (data->pending_messages, msg);
-
-                        service_session = gupnp_service_get_session (data->service);
-
-                        soup_session_requeue_message (service_session, msg);
+                        /* Get property-set from old message */
+                        buffer = soup_message_body_flatten (msg->request_body);
+                        soup_buffer_get_data (buffer,
+                                              (const guint8 **) &property_set,
+                                              &length);
+                        notify_subscriber (NULL, data, property_set);
+                        soup_buffer_free (buffer);
                 } else {
                         /* Emit 'notify-failed' signal */
                         GError *error;


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