Mercurial > hg > nginx
comparison src/stream/ngx_stream_proxy_module.c @ 6124:f1f222db290b
Stream: prevent repeated event notifications after eof.
When client or upstream connection is closed, level-triggered read event
remained active until the end of the session leading to cpu hog. Now the flag
NGX_CLOSE_EVENT is used to unschedule the event.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 22 Apr 2015 19:55:04 +0300 |
parents | 61d7ae76647d |
children | b2899e7d0ef8 |
comparison
equal
deleted
inserted
replaced
6123:caa103acf180 | 6124:f1f222db290b |
---|---|
812 ngx_uint_t do_write) | 812 ngx_uint_t do_write) |
813 { | 813 { |
814 size_t size; | 814 size_t size; |
815 ssize_t n; | 815 ssize_t n; |
816 ngx_buf_t *b; | 816 ngx_buf_t *b; |
817 ngx_uint_t flags; | |
817 ngx_connection_t *c, *pc, *src, *dst; | 818 ngx_connection_t *c, *pc, *src, *dst; |
818 ngx_log_handler_pt handler; | 819 ngx_log_handler_pt handler; |
819 ngx_stream_upstream_t *u; | 820 ngx_stream_upstream_t *u; |
820 ngx_stream_proxy_srv_conf_t *pscf; | 821 ngx_stream_proxy_srv_conf_t *pscf; |
821 | 822 |
909 | 910 |
910 ngx_stream_proxy_finalize(s, NGX_OK); | 911 ngx_stream_proxy_finalize(s, NGX_OK); |
911 return NGX_DONE; | 912 return NGX_DONE; |
912 } | 913 } |
913 | 914 |
914 if (ngx_handle_read_event(src->read, 0) != NGX_OK) { | 915 flags = src->read->eof ? NGX_CLOSE_EVENT : 0; |
916 | |
917 if (ngx_handle_read_event(src->read, flags) != NGX_OK) { | |
915 ngx_stream_proxy_finalize(s, NGX_ERROR); | 918 ngx_stream_proxy_finalize(s, NGX_ERROR); |
916 return NGX_ERROR; | 919 return NGX_ERROR; |
917 } | 920 } |
918 | 921 |
919 if (dst) { | 922 if (dst) { |