]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http: adjust_pollset fix
authorStefan Eissing <stefan@eissing.org>
Thu, 4 Jan 2024 09:06:17 +0000 (10:06 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 4 Jan 2024 14:45:22 +0000 (15:45 +0100)
do not add a socket for POLLIN when the transfer does not want to send
(for example is paused).

Follow-up to 47f5b1a

Reported-by: bubbleguuum on github
Fixes #12632
Closes #12633

lib/cf-socket.c
lib/http2.c
lib/vquic/curl_ngtcp2.c
lib/vquic/curl_quiche.c

index bd4f0d1e97e2d35e429a053ea7afa19529014902..c86aa7e7c2a96996a56c9680a01e8aa9b1ccb2a9 100644 (file)
@@ -1243,7 +1243,7 @@ static void cf_socket_adjust_pollset(struct Curl_cfilter *cf,
   if(ctx->sock != CURL_SOCKET_BAD) {
     if(!cf->connected)
       Curl_pollset_set_out_only(data, ps, ctx->sock);
-    else
+    else if(CURL_WANT_RECV(data))
       Curl_pollset_add_in(data, ps, ctx->sock);
     CURL_TRC_CF(data, cf, "adjust_pollset -> %d socks", ps->num);
   }
index dcc24ea102302ce7497c2ef102862a544db66b85..b7a08607945357a63c7f157c2de912852595e48c 100644 (file)
@@ -2341,8 +2341,8 @@ static void cf_h2_adjust_pollset(struct Curl_cfilter *cf,
     bool c_exhaust, s_exhaust;
 
     CF_DATA_SAVE(save, cf, data);
-    c_exhaust = !nghttp2_session_get_remote_window_size(ctx->h2);
-    s_exhaust = stream && stream->id >= 0 &&
+    c_exhaust = want_send && !nghttp2_session_get_remote_window_size(ctx->h2);
+    s_exhaust = want_send && stream && stream->id >= 0 &&
                 !nghttp2_session_get_stream_remote_window_size(ctx->h2,
                                                                stream->id);
     want_recv = (want_recv || c_exhaust || s_exhaust);
index f4edf2d636ef9397cf780d28f7ad00eac7958a7c..89f690462d640bd7162b5f751999aff186735f09 100644 (file)
@@ -1166,9 +1166,10 @@ static void cf_ngtcp2_adjust_pollset(struct Curl_cfilter *cf,
     bool c_exhaust, s_exhaust;
 
     CF_DATA_SAVE(save, cf, data);
-    c_exhaust = !ngtcp2_conn_get_cwnd_left(ctx->qconn) ||
-                !ngtcp2_conn_get_max_data_left(ctx->qconn);
-    s_exhaust = stream && stream->id >= 0 && stream->quic_flow_blocked;
+    c_exhaust = want_send && (!ngtcp2_conn_get_cwnd_left(ctx->qconn) ||
+                !ngtcp2_conn_get_max_data_left(ctx->qconn));
+    s_exhaust = want_send && stream && stream->id >= 0 &&
+                stream->quic_flow_blocked;
     want_recv = (want_recv || c_exhaust || s_exhaust);
     want_send = (!s_exhaust && want_send) ||
                  !Curl_bufq_is_empty(&ctx->q.sendbuf);
index 33c2621dc8bf63e43b75f2c01dc79ad1cc779814..9c4df2df0f695521b76b719821361593370f9021 100644 (file)
@@ -1189,7 +1189,7 @@ static void cf_quiche_adjust_pollset(struct Curl_cfilter *cf,
 
     c_exhaust = FALSE; /* Have not found any call in quiche that tells
                           us if the connection itself is blocked */
-    s_exhaust = stream && stream->id >= 0 &&
+    s_exhaust = want_send && stream && stream->id >= 0 &&
                 (stream->quic_flow_blocked || !stream_is_writeable(cf, data));
     want_recv = (want_recv || c_exhaust || s_exhaust);
     want_send = (!s_exhaust && want_send) ||