[libgdata] core: Fix error notification of cancelled messages



commit 26532799c10145c31dc07d95c8f69b71c72d9539
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Jul 2 13:02:17 2013 +0100

    core: Fix error notification of cancelled messages
    
    If a message is cancelled during (e.g.) DNS resolution or SSL handshaking,
    libsoup will return SOUP_STATUS_SSL_FAILED (and friends) rather than
    SOUP_STATUS_CANCELLED, which was causing occasional spurious failures in
    the test suite (due to the wrong error messages being set). Fix this by
    explicitly converting SOUP_STATUS_SSL_FAILED (etc.) to
    SOUP_STATUS_CANCELLED if the cancellable is cancelled.

 gdata/gdata-service.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 42b795e..928ca40 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -639,7 +639,9 @@ _gdata_service_actually_send_message (SoupSession *session, SoupMessage *message
        g_assert (message->status_code != SOUP_STATUS_NONE);
 
        if (message->status_code == SOUP_STATUS_CANCELLED ||
-           (message->status_code == SOUP_STATUS_IO_ERROR && cancellable != NULL && 
g_cancellable_is_cancelled (cancellable) == TRUE)) {
+           ((message->status_code == SOUP_STATUS_IO_ERROR || message->status_code == SOUP_STATUS_SSL_FAILED 
||
+             message->status_code == SOUP_STATUS_CANT_CONNECT || message->status_code == 
SOUP_STATUS_CANT_RESOLVE) &&
+            cancellable != NULL && g_cancellable_is_cancelled (cancellable) == TRUE)) {
                /* We hackily create and cancel a new GCancellable so that we can set the error using it and 
therefore save ourselves a translatable
                 * string and the associated maintenance. */
                GCancellable *error_cancellable = g_cancellable_new ();


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