Welcome! Log In Create A New Profile

Advanced

[PATCH 2 of 2] QUIC: stream event setting function

Roman Arutyunyan
January 26, 2022 04:14AM
# HG changeset patch
# User Roman Arutyunyan <arut@nginx.com>
# Date 1643187691 -10800
# Wed Jan 26 12:01:31 2022 +0300
# Branch quic
# Node ID b019e99bc72b2fe0027af25c9cc1bf33c287eb22
# Parent 42776baa77bea8da4cc0e3a157f122f0803b1e97
QUIC: stream event setting function.

The function ngx_quic_set_event() is now called instead of posting events
directly.

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
@@ -34,6 +34,7 @@ static ngx_int_t ngx_quic_control_flow(n
static ngx_int_t ngx_quic_update_flow(ngx_connection_t *c, uint64_t last);
static ngx_int_t ngx_quic_update_max_stream_data(ngx_connection_t *c);
static ngx_int_t ngx_quic_update_max_data(ngx_connection_t *c);
+static void ngx_quic_set_event(ngx_event_t *ev);


ngx_connection_t *
@@ -1022,7 +1023,6 @@ ngx_quic_handle_stream_frame(ngx_connect
ngx_quic_frame_t *frame)
{
uint64_t last;
- ngx_event_t *rev;
ngx_connection_t *sc;
ngx_quic_stream_t *qs;
ngx_quic_connection_t *qc;
@@ -1100,12 +1100,7 @@ ngx_quic_handle_stream_frame(ngx_connect
}

if (f->offset == qs->recv_offset) {
- rev = sc->read;
- rev->ready = 1;
-
- if (rev->active) {
- ngx_post_event(rev, &ngx_posted_events);
- }
+ ngx_quic_set_event(sc->read);
}

return NGX_OK;
@@ -1116,7 +1111,6 @@ ngx_int_t
ngx_quic_handle_max_data_frame(ngx_connection_t *c,
ngx_quic_max_data_frame_t *f)
{
- ngx_event_t *wev;
ngx_rbtree_t *tree;
ngx_rbtree_node_t *node;
ngx_quic_stream_t *qs;
@@ -1138,12 +1132,7 @@ ngx_quic_handle_max_data_frame(ngx_conne
node = ngx_rbtree_next(tree, node))
{
qs = (ngx_quic_stream_t *) node;
- wev = qs->connection->write;
-
- if (wev->active) {
- wev->ready = 1;
- ngx_post_event(wev, &ngx_posted_events);
- }
+ ngx_quic_set_event(qs->connection->write);
}
}

@@ -1204,7 +1193,6 @@ ngx_quic_handle_max_stream_data_frame(ng
ngx_quic_header_t *pkt, ngx_quic_max_stream_data_frame_t *f)
{
uint64_t sent;
- ngx_event_t *wev;
ngx_quic_stream_t *qs;
ngx_quic_connection_t *qc;

@@ -1234,12 +1222,7 @@ ngx_quic_handle_max_stream_data_frame(ng
sent = qs->connection->sent;

if (sent >= qs->send_max_data) {
- wev = qs->connection->write;
-
- if (wev->active) {
- wev->ready = 1;
- ngx_post_event(wev, &ngx_posted_events);
- }
+ ngx_quic_set_event(qs->connection->write);
}

qs->send_max_data = f->limit;
@@ -1252,7 +1235,6 @@ ngx_int_t
ngx_quic_handle_reset_stream_frame(ngx_connection_t *c,
ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f)
{
- ngx_event_t *rev;
ngx_connection_t *sc;
ngx_quic_stream_t *qs;
ngx_quic_connection_t *qc;
@@ -1306,12 +1288,7 @@ ngx_quic_handle_reset_stream_frame(ngx_c
return NGX_ERROR;
}

- rev = sc->read;
- rev->ready = 1;
-
- if (rev->active) {
- ngx_post_event(rev, &ngx_posted_events);
- }
+ ngx_quic_set_event(qs->connection->read);

return NGX_OK;
}
@@ -1321,7 +1298,6 @@ ngx_int_t
ngx_quic_handle_stop_sending_frame(ngx_connection_t *c,
ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f)
{
- ngx_event_t *wev;
ngx_quic_stream_t *qs;
ngx_quic_connection_t *qc;

@@ -1348,12 +1324,7 @@ ngx_quic_handle_stop_sending_frame(ngx_c
return NGX_ERROR;
}

- wev = qs->connection->write;
-
- if (wev->active) {
- wev->ready = 1;
- ngx_post_event(wev, &ngx_posted_events);
- }
+ ngx_quic_set_event(qs->connection->write);

return NGX_OK;
}
@@ -1392,7 +1363,6 @@ void
ngx_quic_handle_stream_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
{
uint64_t sent, unacked;
- ngx_event_t *wev;
ngx_quic_stream_t *qs;
ngx_quic_connection_t *qc;

@@ -1403,13 +1373,11 @@ ngx_quic_handle_stream_ack(ngx_connectio
return;
}

- wev = qs->connection->write;
sent = qs->connection->sent;
unacked = sent - qs->acked;

- if (unacked >= qc->conf->stream_buffer_size && wev->active) {
- wev->ready = 1;
- ngx_post_event(wev, &ngx_posted_events);
+ if (unacked >= qc->conf->stream_buffer_size) {
+ ngx_quic_set_event(qs->connection->write);
}

qs->acked += f->u.stream.length;
@@ -1581,6 +1549,17 @@ ngx_quic_update_max_data(ngx_connection_
}


+static void
+ngx_quic_set_event(ngx_event_t *ev)
+{
+ ev->ready = 1;
+
+ if (ev->active) {
+ ngx_post_event(ev, &ngx_posted_events);
+ }
+}
+
+
ngx_int_t
ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
{
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[PATCH 0 of 2] QUIC stream states and events

Roman Arutyunyan 361 January 26, 2022 04:10AM

[PATCH 1 of 2] QUIC: introduced explicit stream states

Roman Arutyunyan 97 January 26, 2022 04:12AM

[PATCH 2 of 2] QUIC: stream event setting function

Roman Arutyunyan 148 January 26, 2022 04:14AM

[PATCH 0 of 3] QUIC stream states and events

Roman Arutyunyan 100 January 31, 2022 02:36AM

[PATCH 1 of 3] QUIC: introduced explicit stream states

Roman Arutyunyan 93 January 31, 2022 02:38AM

Re: [PATCH 1 of 3] QUIC: introduced explicit stream states

Vladimir Homutov 87 January 31, 2022 05:20AM

Re: [PATCH 1 of 3] QUIC: introduced explicit stream states

Roman Arutyunyan 93 January 31, 2022 10:14AM

[PATCH 2 of 3] HTTP/3: proper uni stream closure detection

Roman Arutyunyan 120 January 31, 2022 02:40AM

Re: [PATCH 2 of 3] HTTP/3: proper uni stream closure detection

Vladimir Homutov 79 January 31, 2022 05:44AM

Re: [PATCH 2 of 3] HTTP/3: proper uni stream closure detection

Roman Arutyunyan 92 January 31, 2022 10:16AM

[PATCH 3 of 3] QUIC: stream event setting function

Roman Arutyunyan 95 January 31, 2022 02:42AM

Re: [PATCH 3 of 3] QUIC: stream event setting function

Vladimir Homutov 106 January 31, 2022 07:22AM

[PATCH 0 of 4] QUIC stream states and events

Roman Arutyunyan 178 January 31, 2022 10:24AM

[PATCH 1 of 4] QUIC: introduced explicit stream states

Roman Arutyunyan 129 January 31, 2022 10:26AM

[PATCH 2 of 4] HTTP/3: proper uni stream closure detection

Roman Arutyunyan 103 January 31, 2022 10:28AM

[PATCH 3 of 4] QUIC: style

Roman Arutyunyan 104 January 31, 2022 10:30AM

[PATCH 4 of 4] QUIC: stream event setting function

Roman Arutyunyan 144 January 31, 2022 10:32AM

Re: [PATCH 0 of 4] QUIC stream states and events

Vladimir Homutov 136 January 31, 2022 12:16PM



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

Online Users

Guests: 302
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