mirror of
https://github.com/nginx/nginx.git
synced 2025-06-23 06:28:29 +08:00
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.
This commit is contained in:
parent
1fe0913fcc
commit
77fc6b7fb9
@ -274,7 +274,7 @@ ngx_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
|
|||||||
c = rev->data;
|
c = rev->data;
|
||||||
|
|
||||||
if (c->quic) {
|
if (c->quic) {
|
||||||
return ngx_quic_handle_read_event(rev, flags);
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -353,7 +353,7 @@ ngx_handle_write_event(ngx_event_t *wev, size_t lowat)
|
|||||||
|
|
||||||
#if (NGX_QUIC)
|
#if (NGX_QUIC)
|
||||||
if (c->quic) {
|
if (c->quic) {
|
||||||
return ngx_quic_handle_write_event(wev, lowat);
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -123,8 +123,6 @@ void ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_uint_t err,
|
|||||||
ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err);
|
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);
|
ngx_int_t ngx_quic_shutdown_stream(ngx_connection_t *c, int how);
|
||||||
void ngx_quic_cancelable_stream(ngx_connection_t *c);
|
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_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len,
|
||||||
ngx_str_t *dcid);
|
ngx_str_t *dcid);
|
||||||
ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
|
ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
|
||||||
|
@ -700,9 +700,16 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id)
|
|||||||
if ((id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0
|
if ((id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0
|
||||||
|| (id & NGX_QUIC_STREAM_SERVER_INITIATED))
|
|| (id & NGX_QUIC_STREAM_SERVER_INITIATED))
|
||||||
{
|
{
|
||||||
|
sc->write->active = 1;
|
||||||
sc->write->ready = 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_UNIDIRECTIONAL) {
|
||||||
if (id & NGX_QUIC_STREAM_SERVER_INITIATED) {
|
if (id & NGX_QUIC_STREAM_SERVER_INITIATED) {
|
||||||
qs->send_max_data = qc->ctp.initial_max_stream_data_uni;
|
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_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;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user