diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2021-09-09 16:55:00 +0300 |
|---|---|---|
| committer | Roman Arutyunyan <arut@nginx.com> | 2021-09-09 16:55:00 +0300 |
| commit | 00bb4e4b8d2c6fa9a9323b158cfc22071b848e87 (patch) | |
| tree | 1c917d7dfea6400bad0ffdad8bad2909a355d8d8 /src/event/quic | |
| parent | 9d7f2e79176b3fc73c06e8ba1594f287b4536bbe (diff) | |
| download | nginx-00bb4e4b8d2c6fa9a9323b158cfc22071b848e87.tar.gz nginx-00bb4e4b8d2c6fa9a9323b158cfc22071b848e87.tar.bz2 | |
QUIC: separate event handling functions.
The functions ngx_quic_handle_read_event() and ngx_quic_handle_write_event()
are added. Previously this code was a part of ngx_handle_read_event() and
ngx_handle_write_event().
The change simplifies ngx_handle_read_event() and ngx_handle_write_event()
by moving QUIC-related code to a QUIC source file.
Diffstat (limited to 'src/event/quic')
| -rw-r--r-- | src/event/quic/ngx_event_quic.h | 2 | ||||
| -rw-r--r-- | src/event/quic/ngx_event_quic_streams.c | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/event/quic/ngx_event_quic.h b/src/event/quic/ngx_event_quic.h index d425cee31..dda1e385e 100644 --- a/src/event/quic/ngx_event_quic.h +++ b/src/event/quic/ngx_event_quic.h @@ -93,6 +93,8 @@ void ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_uint_t err, const char *reason); ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err); uint32_t ngx_quic_version(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 index a4f4cb57c..69c7220cf 100644 --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -1470,3 +1470,31 @@ ngx_quic_update_flow(ngx_connection_t *c, uint64_t last) return NGX_OK; } + + +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; +} |
