summaryrefslogtreecommitdiff
path: root/libsoup/soup-client-input-stream.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-09-29 09:06:37 -0400
committerDan Winship <danw@gnome.org>2013-09-29 10:45:13 -0400
commit96da2df64c9dd8cc52e97ce73e54615d6b520664 (patch)
tree9a3047c4779b22af29f179a6195daa5db4ba2003 /libsoup/soup-client-input-stream.c
parenta5d3351caf88824db7de968f312565851d47840a (diff)
downloadlibsoup-96da2df64c9dd8cc52e97ce73e54615d6b520664.tar.gz
Fix soup_client_input_stream_close to not block
Closing a SoupClientInputStream for a message that hadn't been completely read was trying to read to the end of the message first. Fix it to just cancel the read instead. Also fix a few tests that were implicitly assuming the old behavior. https://bugzilla.gnome.org/show_bug.cgi?id=695652
Diffstat (limited to 'libsoup/soup-client-input-stream.c')
-rw-r--r--libsoup/soup-client-input-stream.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index d73fb007..87fa49d6 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -187,11 +187,13 @@ soup_client_input_stream_close_async (GInputStream *stream,
task = g_task_new (stream, cancellable, callback, user_data);
g_task_set_priority (task, priority);
- source = soup_message_io_get_source (cistream->priv->msg,
- cancellable, NULL, NULL);
-
- g_task_attach_source (task, source, (GSourceFunc) close_async_ready);
- g_source_unref (source);
+ if (close_async_ready (cistream->priv->msg, task) == G_SOURCE_CONTINUE) {
+ source = soup_message_io_get_source (cistream->priv->msg,
+ cancellable, NULL, NULL);
+
+ g_task_attach_source (task, source, (GSourceFunc) close_async_ready);
+ g_source_unref (source);
+ }
}
static gboolean