[libsoup] io-http2: only try to read on need more data callback



commit d49da08753e80cd7b3b515342576ed014fb85bd3
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu May 20 16:35:55 2021 +0200

    io-http2: only try to read on need more data callback

 libsoup/http2/soup-client-message-io-http2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index c798533b..1b3d8700 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -111,6 +111,7 @@ typedef struct {
         guint32 stream_id;
 } SoupHTTP2MessageData;
 
+static gboolean io_read (SoupClientMessageIOHTTP2 *, gboolean, GCancellable *, GError **);
 static gboolean io_read_or_write (SoupHTTP2MessageData *, gboolean, GCancellable *, GError **);
 
 static void
@@ -308,7 +309,9 @@ memory_stream_need_more_data_callback (SoupBodyInputStreamHttp2 *stream,
         SoupHTTP2MessageData *data = (SoupHTTP2MessageData*)user_data;
         GError *error = NULL;
 
-        io_read_or_write (data, blocking, cancellable, &error);
+        if (!nghttp2_session_want_read (data->io->session))
+                return blocking ? NULL : g_error_new_literal (G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, 
_("Operation would block"));
+        io_read (data->io, blocking, cancellable, &error);
 
         return error;
 }


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