[libsoup] SoupSessionAsync: make soup_session_cancel_message behave stupidly again
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] SoupSessionAsync: make soup_session_cancel_message behave stupidly again
- Date: Wed, 28 Jul 2010 12:55:11 +0000 (UTC)
commit ff806c1ce90e637c9c327a561aa2f4d072480908
Author: Dan Winship <danw gnome org>
Date: Wed Jul 28 14:51:06 2010 +0200
SoupSessionAsync: make soup_session_cancel_message behave stupidly again
The session rewrites changed cancellation in async sessions to happen
asynchronously. This makes more sense than the old behavior, but can
cause problems with code that previously assumed it could
cancel-and-forget (and it wasn't actually an intentional change
anyway). So revert that.
https://bugzilla.gnome.org/show_bug.cgi?id=625406
libsoup/soup-session-async.c | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/soup-session-async.c b/libsoup/soup-session-async.c
index b468f10..d05e057 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -37,6 +37,8 @@ static void do_idle_run_queue (SoupSession *session);
static void queue_message (SoupSession *session, SoupMessage *req,
SoupSessionCallback callback, gpointer user_data);
static guint send_message (SoupSession *session, SoupMessage *req);
+static void cancel_message (SoupSession *session, SoupMessage *msg,
+ guint status_code);
static void auth_required (SoupSession *session, SoupMessage *msg,
SoupAuth *auth, gboolean retrying);
@@ -76,6 +78,7 @@ soup_session_async_class_init (SoupSessionAsyncClass *soup_session_async_class)
/* virtual method override */
session_class->queue_message = queue_message;
session_class->send_message = send_message;
+ session_class->cancel_message = cancel_message;
session_class->auth_required = auth_required;
object_class->finalize = finalize;
@@ -324,7 +327,8 @@ got_connection (SoupConnection *conn, guint status, gpointer user_data)
static void
process_queue_item (SoupMessageQueueItem *item,
- gboolean *should_prune)
+ gboolean *should_prune,
+ gboolean loop)
{
SoupSession *session = item->session;
SoupProxyURIResolver *proxy_resolver;
@@ -387,7 +391,7 @@ process_queue_item (SoupMessageQueueItem *item,
*/
return;
}
- } while (item->state != SOUP_MESSAGE_FINISHED);
+ } while (loop && item->state != SOUP_MESSAGE_FINISHED);
}
static void
@@ -410,7 +414,7 @@ run_queue (SoupSessionAsync *sa)
/* CONNECT messages are handled specially */
if (msg->method != SOUP_METHOD_CONNECT)
- process_queue_item (item, &should_prune);
+ process_queue_item (item, &should_prune, TRUE);
}
if (item)
soup_message_queue_item_unref (item);
@@ -484,6 +488,31 @@ send_message (SoupSession *session, SoupMessage *req)
}
static void
+cancel_message (SoupSession *session, SoupMessage *msg,
+ guint status_code)
+{
+ SoupMessageQueue *queue;
+ SoupMessageQueueItem *item;
+ gboolean dummy;
+
+ SOUP_SESSION_CLASS (soup_session_async_parent_class)->
+ cancel_message (session, msg, status_code);
+
+ queue = soup_session_get_queue (session);
+ item = soup_message_queue_lookup (queue, msg);
+ if (!item || item->state != SOUP_MESSAGE_FINISHING)
+ return;
+
+ /* Force it to finish immediately, so that
+ * soup_session_abort (session); g_object_unref (session);
+ * will work.
+ */
+ process_queue_item (item, &dummy, FALSE);
+
+ soup_message_queue_item_unref (item);
+}
+
+static void
got_passwords (SoupPasswordManager *password_manager, SoupMessage *msg,
SoupAuth *auth, gboolean retrying, gpointer session)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]