Welcome! Log In Create A New Profile

Advanced

[PATCH 1 of 4] QUIC: automatically add and never delete stream events

Roman Arutyunyan
January 10, 2023 08:30AM
# HG changeset patch
# User Roman Arutyunyan <arut@nginx.com>
# Date 1673345118 -14400
# Tue Jan 10 14:05:18 2023 +0400
# Branch quic
# Node ID f89ce033b2fa161f7258f824dcf3c6ef2051f45f
# Parent 987bee4363d10895f4bd1a40fc4347c49763e90f
QUIC: automatically add and never delete stream events.

Previously, stream events were added and deleted by ngx_handle_read_event() and
ngx_handle_write_event() in a way similar to level-triggered events. However,
QUIC stream events are effectively edge-triggered and can stay active all time.
Moreover, the events are now active since the moment a stream is created.

diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -274,7 +274,7 @@ ngx_handle_read_event(ngx_event_t *rev,
c = rev->data;

if (c->quic) {
- return ngx_quic_handle_read_event(rev, flags);
+ return NGX_OK;
}

#endif
@@ -353,7 +353,7 @@ ngx_handle_write_event(ngx_event_t *wev,

#if (NGX_QUIC)
if (c->quic) {
- return ngx_quic_handle_write_event(wev, lowat);
+ return NGX_OK;
}
#endif

diff --git a/src/event/quic/ngx_event_quic.h b/src/event/quic/ngx_event_quic.h
--- a/src/event/quic/ngx_event_quic.h
+++ b/src/event/quic/ngx_event_quic.h
@@ -123,8 +123,6 @@ void ngx_quic_shutdown_connection(ngx_co
ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err);
ngx_int_t ngx_quic_shutdown_stream(ngx_connection_t *c, int how);
void ngx_quic_cancelable_stream(ngx_connection_t *c);
-ngx_int_t ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags);
-ngx_int_t ngx_quic_handle_write_event(ngx_event_t *wev, size_t lowat);
ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len,
ngx_str_t *dcid);
ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c
--- a/src/event/quic/ngx_event_quic_streams.c
+++ b/src/event/quic/ngx_event_quic_streams.c
@@ -699,9 +699,16 @@ ngx_quic_create_stream(ngx_connection_t
if ((id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0
|| (id & NGX_QUIC_STREAM_SERVER_INITIATED))
{
+ sc->write->active = 1;
sc->write->ready = 1;
}

+ if ((id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0
+ || (id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0)
+ {
+ sc->read->active = 1;
+ }
+
if (id & NGX_QUIC_STREAM_UNIDIRECTIONAL) {
if (id & NGX_QUIC_STREAM_SERVER_INITIATED) {
qs->send_max_data = qc->ctp.initial_max_stream_data_uni;
@@ -1745,31 +1752,3 @@ ngx_quic_set_event(ngx_event_t *ev)
ngx_post_event(ev, &ngx_posted_events);
}
}
-
-
-ngx_int_t
-ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
-{
- if (!rev->active && !rev->ready) {
- rev->active = 1;
-
- } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
- rev->active = 0;
- }
-
- return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_quic_handle_write_event(ngx_event_t *wev, size_t lowat)
-{
- if (!wev->active && !wev->ready) {
- wev->active = 1;
-
- } else if (wev->active && wev->ready) {
- wev->active = 0;
- }
-
- return NGX_OK;
-}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 0 of 3] HTTP/3 insert count block improvements

Roman Arutyunyan 442 January 05, 2023 10:32AM

[PATCH 1 of 3] QUIC: set stream error flag on reset

Roman Arutyunyan 89 January 05, 2023 10:32AM

Re: [PATCH 1 of 3] QUIC: set stream error flag on reset

Sergey Kandaurov 87 January 06, 2023 06:18AM

[PATCH 2 of 3] HTTP/3: trigger 400 (Bad Request) on stream error while blocked

Roman Arutyunyan 97 January 05, 2023 10:32AM

[PATCH 3 of 3] HTTP/3: insert count block timeout

Roman Arutyunyan 110 January 05, 2023 10:32AM

[PATCH 0 of 4] HTTP/3 insert count block improvements

Roman Arutyunyan 86 January 10, 2023 08:30AM

[PATCH 1 of 4] QUIC: automatically add and never delete stream events

Roman Arutyunyan 96 January 10, 2023 08:30AM

[PATCH 2 of 4] QUIC: set stream error flag on reset

Roman Arutyunyan 98 January 10, 2023 08:30AM

[PATCH 3 of 4] HTTP/3: trigger 400 (Bad Request) on stream error while blocked

Roman Arutyunyan 94 January 10, 2023 08:30AM

[PATCH 4 of 4] HTTP/3: insert count block timeout

Roman Arutyunyan 89 January 10, 2023 08:30AM

Re: [PATCH 0 of 4] HTTP/3 insert count block improvements

Sergey Kandaurov 122 January 10, 2023 08:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 188
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready