comparison src/mail/ngx_mail_proxy_module.c @ 7156:9c29644f6d03

Fixed worker_shutdown_timeout in various cases. The ngx_http_upstream_process_upgraded() did not handle c->close request, and upgraded connections do not use the write filter. As a result, worker_shutdown_timeout did not affect upgraded connections (ticket #1419). Fix is to handle c->close in the ngx_http_request_handler() function, thus covering most of the possible cases in http handling. Additionally, mail proxying did not handle neither c->close nor c->error, and thus worker_shutdown_timeout did not work for mail connections. Fix is to add c->close handling to ngx_mail_proxy_handler(). Also, added explicit handling of c->close to stream proxy, ngx_stream_proxy_process_connection(). This improves worker_shutdown_timeout handling in stream, it will no longer wait for some data being transferred in a connection before closing it, and will also provide appropriate logging at the "info" level.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 20 Nov 2017 16:31:07 +0300
parents f01ab2dbcfdc
children d63c5373b5ba
comparison
equal deleted inserted replaced
7155:29e9571b1989 7156:9c29644f6d03
880 ngx_mail_proxy_conf_t *pcf; 880 ngx_mail_proxy_conf_t *pcf;
881 881
882 c = ev->data; 882 c = ev->data;
883 s = c->data; 883 s = c->data;
884 884
885 if (ev->timedout) { 885 if (ev->timedout || c->close) {
886 c->log->action = "proxying"; 886 c->log->action = "proxying";
887 887
888 if (c == s->connection) { 888 if (c->close) {
889 ngx_log_error(NGX_LOG_INFO, c->log, 0, "shutdown timeout");
890
891 } else if (c == s->connection) {
889 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, 892 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
890 "client timed out"); 893 "client timed out");
891 c->timedout = 1; 894 c->timedout = 1;
892 895
893 } else { 896 } else {