[PATCH 1 of 9] QUIC: treat qc->error == -1 as a missing error

Roman Arutyunyan arut at nginx.com
Tue Aug 23 12:51:10 UTC 2022


# HG changeset patch
# User Roman Arutyunyan <arut at nginx.com>
# Date 1660223647 -14400
#      Thu Aug 11 17:14:07 2022 +0400
# Branch quic
# Node ID d928c8ca3415be4e9cced59a3cb9fc70249a0d9d
# Parent  f9d7930d0eedae28defd0803cb95dc8ab68e56b3
QUIC: treat qc->error == -1 as a missing error.

Previously, zero was used for this purpose.  However, NGX_QUIC_ERR_NO_ERROR is
zero too.  As a result, NGX_QUIC_ERR_NO_ERROR was changed to
NGX_QUIC_ERR_INTERNAL_ERROR when closing a QUIC connection.

diff --git a/src/event/quic/ngx_event_quic.c b/src/event/quic/ngx_event_quic.c
--- a/src/event/quic/ngx_event_quic.c
+++ b/src/event/quic/ngx_event_quic.c
@@ -523,7 +523,7 @@ ngx_quic_close_connection(ngx_connection
                 qc->error = NGX_QUIC_ERR_NO_ERROR;
 
             } else {
-                if (qc->error == 0 && !qc->error_app) {
+                if (qc->error == (ngx_uint_t) -1 && !qc->error_app) {
                     qc->error = NGX_QUIC_ERR_INTERNAL_ERROR;
                 }
 
@@ -939,7 +939,7 @@ ngx_quic_handle_payload(ngx_connection_t
 
     qc = ngx_quic_get_connection(c);
 
-    qc->error = 0;
+    qc->error = (ngx_uint_t) -1;
     qc->error_reason = 0;
 
     c->log->action = "decrypting packet";



More information about the nginx-devel mailing list