Welcome! Log In Create A New Profile

Advanced

[nginx] Resolver: added missing event handling after reading.

Maxim Dounin
March 28, 2021 10:48AM
details: https://hg.nginx.org/nginx/rev/eb54227110f0
branches:
changeset: 7808:eb54227110f0
user: Maxim Dounin <mdounin@mdounin.ru>
date: Sun Mar 28 17:45:31 2021 +0300
description:
Resolver: added missing event handling after reading.

If we need to be notified about further events, ngx_handle_read_event()
needs to be called after a read event is processed. Without this,
an event can be removed from the kernel and won't be reported again,
notably when using oneshot event methods, such as eventport on Solaris.

While here, error handling is also added, similar to one present in
ngx_resolver_tcp_read(). This is not expected to make a difference
and mostly added for consistency.

diffstat:

src/core/ngx_resolver.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r e0844646099b -r eb54227110f0 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c Sun Mar 28 17:45:29 2021 +0300
+++ b/src/core/ngx_resolver.c Sun Mar 28 17:45:31 2021 +0300
@@ -1563,13 +1563,28 @@ ngx_resolver_udp_read(ngx_event_t *rev)
do {
n = ngx_udp_recv(c, buf, NGX_RESOLVER_UDP_SIZE);

- if (n < 0) {
- return;
+ if (n == NGX_AGAIN) {
+ break;
+ }
+
+ if (n == NGX_ERROR) {
+ goto failed;
}

ngx_resolver_process_response(rec->resolver, buf, n, 0);

} while (rev->ready);
+
+ if (ngx_handle_read_event(rev, 0) != NGX_OK) {
+ goto failed;
+ }
+
+ return;
+
+failed:
+
+ ngx_close_connection(rec->udp);
+ rec->udp = NULL;
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Resolver: added missing event handling after reading.

Maxim Dounin 58 March 28, 2021 10:48AM



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

Online Users

Guests: 51
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready