mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
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.
This commit is contained in:
parent
fd0546aa33
commit
cb9fca0846
@ -1563,13 +1563,28 @@ ngx_resolver_udp_read(ngx_event_t *rev)
|
|||||||
do {
|
do {
|
||||||
n = ngx_udp_recv(c, buf, NGX_RESOLVER_UDP_SIZE);
|
n = ngx_udp_recv(c, buf, NGX_RESOLVER_UDP_SIZE);
|
||||||
|
|
||||||
if (n < 0) {
|
if (n == NGX_AGAIN) {
|
||||||
return;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n == NGX_ERROR) {
|
||||||
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_resolver_process_response(rec->resolver, buf, n, 0);
|
ngx_resolver_process_response(rec->resolver, buf, n, 0);
|
||||||
|
|
||||||
} while (rev->ready);
|
} while (rev->ready);
|
||||||
|
|
||||||
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
|
||||||
|
ngx_close_connection(rec->udp);
|
||||||
|
rec->udp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user