[libsoup] SoupSession: tweak cancellation again
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] SoupSession: tweak cancellation again
- Date: Wed, 9 Jun 2010 17:35:19 +0000 (UTC)
commit b5543c970e75ecea0215d6641b772f3bc8a49075
Author: Dan Winship <danw gnome org>
Date: Wed Jun 9 13:33:10 2010 -0400
SoupSession: tweak cancellation again
After the too-many-redirects merge, redirect-test was leaking a queue
item, because cancelling a message at the point it does resulted in
the completion_cb never running. Fix soup_session_cancel_message()
(again) to not have this problem.
libsoup/soup-message-io.c | 2 +-
libsoup/soup-message-private.h | 1 +
libsoup/soup-session-async.c | 10 ----------
libsoup/soup-session.c | 6 ++++--
4 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 3aa4002..ff1fec2 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -154,7 +154,7 @@ soup_message_io_stop (SoupMessage *msg)
#define SOUP_MESSAGE_IO_EOL "\r\n"
#define SOUP_MESSAGE_IO_EOL_LEN 2
-static void
+void
soup_message_io_finished (SoupMessage *msg)
{
SoupMessagePrivate *priv = SOUP_MESSAGE_GET_PRIVATE (msg);
diff --git a/libsoup/soup-message-private.h b/libsoup/soup-message-private.h
index 5525ed7..2ea2d42 100644
--- a/libsoup/soup-message-private.h
+++ b/libsoup/soup-message-private.h
@@ -86,6 +86,7 @@ SoupAuth *soup_message_get_proxy_auth (SoupMessage *msg);
/* I/O */
void soup_message_io_stop (SoupMessage *msg);
+void soup_message_io_finished (SoupMessage *msg);
void soup_message_io_pause (SoupMessage *msg);
void soup_message_io_unpause (SoupMessage *msg);
gboolean soup_message_io_in_progress (SoupMessage *msg);
diff --git a/libsoup/soup-session-async.c b/libsoup/soup-session-async.c
index ee9ddd7..0df8d82 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -37,8 +37,6 @@ 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);
@@ -78,7 +76,6 @@ 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;
@@ -486,13 +483,6 @@ send_message (SoupSession *session, SoupMessage *req)
}
static void
-cancel_message (SoupSession *session, SoupMessage *msg, guint status_code)
-{
- SOUP_SESSION_CLASS (soup_session_async_parent_class)->cancel_message (session, msg, status_code);
- do_idle_run_queue (session);
-}
-
-static void
got_passwords (SoupPasswordManager *password_manager, SoupMessage *msg,
SoupAuth *auth, gboolean retrying, gpointer session)
{
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index a1147fd..56ead69 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1592,9 +1592,11 @@ cancel_message (SoupSession *session, SoupMessage *msg, guint status_code)
if (item->cancellable)
g_cancellable_cancel (item->cancellable);
- soup_message_io_stop (msg);
soup_message_set_status (msg, status_code);
- item->state = SOUP_MESSAGE_FINISHING;
+ if (soup_message_io_in_progress (msg))
+ soup_message_io_finished (msg);
+ else
+ item->state = SOUP_MESSAGE_FINISHING;
soup_message_queue_item_unref (item);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]