]> git.kaiwu.me - nginx.git/commitdiff
QUIC: allowed ngx_quic_frame_sendto() to return NGX_AGAIN.
authorRoman Arutyunyan <arut@nginx.com>
Tue, 8 Aug 2023 06:43:17 +0000 (10:43 +0400)
committerRoman Arutyunyan <arut@nginx.com>
Tue, 8 Aug 2023 06:43:17 +0000 (10:43 +0400)
Previously, NGX_AGAIN returned by ngx_quic_send() was treated by
ngx_quic_frame_sendto() as error, which triggered errors in its callers.
However, a blocked socket is not an error.  Now NGX_AGAIN is passed as is to
the ngx_quic_frame_sendto() callers, which can safely ignore it.

src/event/quic/ngx_event_quic_migration.c
src/event/quic/ngx_event_quic_output.c

index ca821f8b47b638f4285287ec3afae1c8e5b42c4c..a91b49a1d5986fff0b12f62852b5f8f828290be4 100644 (file)
@@ -46,7 +46,7 @@ ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
      * An endpoint MUST expand datagrams that contain a PATH_RESPONSE frame
      * to at least the smallest allowed maximum datagram size of 1200 bytes.
      */
-    if (ngx_quic_frame_sendto(c, &frame, 1200, pkt->path) != NGX_OK) {
+    if (ngx_quic_frame_sendto(c, &frame, 1200, pkt->path) == NGX_ERROR) {
         return NGX_ERROR;
     }
 
@@ -544,13 +544,13 @@ ngx_quic_send_path_challenge(ngx_connection_t *c, ngx_quic_path_t *path)
      */
 
      /* same applies to PATH_RESPONSE frames */
-    if (ngx_quic_frame_sendto(c, &frame, 1200, path) != NGX_OK) {
+    if (ngx_quic_frame_sendto(c, &frame, 1200, path) == NGX_ERROR) {
         return NGX_ERROR;
     }
 
     ngx_memcpy(frame.u.path_challenge.data, path->challenge2, 8);
 
-    if (ngx_quic_frame_sendto(c, &frame, 1200, path) != NGX_OK) {
+    if (ngx_quic_frame_sendto(c, &frame, 1200, path) == NGX_ERROR) {
         return NGX_ERROR;
     }
 
index 392c7757bcec7a7a6631db33a98875b040c5eff3..a72504b6a6e34ec431ba5352c8393bfe58e6185d 100644 (file)
@@ -1233,7 +1233,7 @@ ngx_quic_frame_sendto(ngx_connection_t *c, ngx_quic_frame_t *frame,
 
     sent = ngx_quic_send(c, res.data, res.len, path->sockaddr, path->socklen);
     if (sent < 0) {
-        return NGX_ERROR;
+        return sent;
     }
 
     path->sent += sent;