[libsoup] io-http2: don't keep reading/writing if io_read/io_write return FALSE



commit f0a1691c17a22906742a523ff7b4f1cac7d9da01
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu May 27 19:09:53 2021 +0200

    io-http2: don't keep reading/writing if io_read/io_write return FALSE

 libsoup/http2/soup-client-message-io-http2.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 686ab864..5f581fb9 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -1428,8 +1428,10 @@ io_idle_read (SoupClientMessageIOHTTP2 *io)
                 g_clear_pointer (&io->idle_read_source, g_source_unref);
         }
 
-        while (nghttp2_session_want_read (io->session) && !error)
-                io_read (io, FALSE, FALSE, &error);
+        while (nghttp2_session_want_read (io->session)) {
+                if (!io_read (io, FALSE, FALSE, &error))
+                        break;
+        }
 
         if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
                 io->idle_read_source = g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM 
(io->istream), NULL);
@@ -1578,8 +1580,10 @@ io_close (SoupClientMessageIOHTTP2 *io)
                 g_clear_pointer (&io->close_source, g_source_unref);
         }
 
-        while (nghttp2_session_want_write (io->session) && !error)
-                io_write (io, FALSE, FALSE, &error);
+        while (nghttp2_session_want_write (io->session)) {
+                if (!io_write (io, FALSE, FALSE, &error))
+                        break;
+        }
 
         if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
                 g_error_free (error);


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