[evolution-ews] Abort any pending operations in case notification was cancelled



commit 050b79366b8659ba1f799a0ee127c48b073d98a9
Author: Fabiano Fidêncio <fidencio redhat com>
Date:   Tue Jan 21 14:17:44 2014 +0100

    Abort any pending operations in case notification was cancelled

 src/server/e-ews-notification.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/server/e-ews-notification.c b/src/server/e-ews-notification.c
index e79bad7..d984d72 100644
--- a/src/server/e-ews-notification.c
+++ b/src/server/e-ews-notification.c
@@ -634,6 +634,7 @@ ews_notification_soup_got_chunk (SoupMessage *msg,
                ESoapResponse *response;
                const gchar *end;
                gsize len;
+               gboolean cancelled = FALSE;
 
                end = g_strstr_len (chunk_str, chunk_len, "</Envelope>");
 
@@ -654,10 +655,16 @@ ews_notification_soup_got_chunk (SoupMessage *msg,
                chunk_str = (gchar *) notification->priv->chunk->data;
                chunk_len = notification->priv->chunk->len;
 
-               if (chunk_len == 0 || g_cancellable_is_cancelled (notification->priv->cancellable)) {
+               cancelled = g_cancellable_is_cancelled (notification->priv->cancellable);
+               if (chunk_len == 0 || cancelled) {
                        g_byte_array_free (notification->priv->chunk, TRUE);
                        notification->priv->chunk = NULL;
                        keep_parsing = FALSE;
+
+                       if (cancelled) {
+                               /* Abort any pending operations */
+                               soup_session_abort (notification->priv->soup_session);
+                       }
                }
        } while (keep_parsing);
 }


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