[libsoup] io-http2: fix io source to not be always dispatched for non-paused messages
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] io-http2: fix io source to not be always dispatched for non-paused messages
- Date: Mon, 24 May 2021 10:56:04 +0000 (UTC)
commit f9d7987fae5c36769ddebc01b21ebe3424a6b71b
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Mon May 24 11:14:28 2021 +0200
io-http2: fix io source to not be always dispatched for non-paused messages
message_source_check should return FALSE unless the source was created
for a paused message that is no longer paused.
libsoup/http2/soup-client-message-io-http2.c | 19 +++++++++++++------
tests/http2-test.c | 2 +-
2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index ddd399cb..89e5c63a 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -936,6 +936,12 @@ soup_client_message_io_http2_pause (SoupClientMessageIO *iface,
if (data->paused)
g_warn_if_reached ();
+ if (data->io_source) {
+ g_source_destroy (data->io_source);
+ g_source_unref (data->io_source);
+ data->io_source = NULL;
+ }
+
data->paused = TRUE;
}
@@ -993,14 +999,15 @@ soup_client_message_io_http2_is_reusable (SoupClientMessageIO *iface)
static gboolean
message_source_check (GSource *source)
{
- SoupMessageIOSource *message_source = (SoupMessageIOSource *)source;
- SoupMessage *msg = SOUP_MESSAGE (message_source->msg);
- SoupClientMessageIOHTTP2 *io = get_io_data (msg);
- SoupHTTP2MessageData *data = get_data_for_message (io, msg);
+ SoupMessageIOSource *message_source = (SoupMessageIOSource *)source;
- /* QUESTION: What is the point of message_source->paused */
+ if (message_source->paused) {
+ if (soup_message_is_io_paused (SOUP_MESSAGE (message_source->msg)))
+ return FALSE;
+ return TRUE;
+ }
- return !data->paused;
+ return FALSE;
}
static GSource *
diff --git a/tests/http2-test.c b/tests/http2-test.c
index dd3214a6..13e2e4c6 100644
--- a/tests/http2-test.c
+++ b/tests/http2-test.c
@@ -314,7 +314,7 @@ do_post_blocked_async_test (Test *test, gconstpointer data)
soup_body_input_stream_http2_add_data (SOUP_BODY_INPUT_STREAM_HTTP2 (in_stream),
(guint8*)" Part 2", 8);
soup_body_input_stream_http2_complete (SOUP_BODY_INPUT_STREAM_HTTP2 (in_stream));
}
- g_main_context_iteration (async_context, TRUE);
+ g_main_context_iteration (async_context, FALSE);
}
g_assert_cmpstr (g_bytes_get_data (response, NULL), ==, "Part 1 - Part 2");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]