summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic_streams.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2023-01-10 14:05:18 +0400
committerRoman Arutyunyan <arut@nginx.com>2023-01-10 14:05:18 +0400
commit77fc6b7fb97f41b900d36a3180cd06c60ae48e52 (patch)
tree37a99f27068490f4aef9d6111005055180b1affa /src/event/quic/ngx_event_quic_streams.c
parent1fe0913fccedfffade10a88d3fb3033339a42900 (diff)
downloadnginx-77fc6b7fb97f41b900d36a3180cd06c60ae48e52.tar.gz
nginx-77fc6b7fb97f41b900d36a3180cd06c60ae48e52.tar.bz2
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.
Diffstat (limited to 'src/event/quic/ngx_event_quic_streams.c')
-rw-r--r--src/event/quic/ngx_event_quic_streams.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c
index 785625547..e062b1fa1 100644
--- a/src/event/quic/ngx_event_quic_streams.c
+++ b/src/event/quic/ngx_event_quic_streams.c
@@ -700,9 +700,16 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id)
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;
@@ -1746,31 +1753,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;
-}