Skip to content

Commit 196a55f

Browse files
bugfix: didn't close cosocket when nginx shutdown timer has been triggered.
1 parent 53c3554 commit 196a55f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ngx_stream_lua_socket_tcp.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2981,7 +2981,15 @@ ngx_stream_lua_socket_tcp_read(ngx_stream_lua_request_t *r,
29812981

29822982
size = b->last - b->pos;
29832983

2984-
if (size || u->eof) {
2984+
/*
2985+
* ngx_shutdown_timer_handler() will set the c->close and c->error
2986+
* flag to 1, indicating the connection needs to be closed.
2987+
*
2988+
* Call the u->input_filter callback function of the request object
2989+
* to trigger the filtering logic. Enable Nginx to exit quickly during
2990+
* the nginx exiting phase.
2991+
*/
2992+
if (size || u->eof || (c->close && c->error)) {
29852993

29862994
rc = u->input_filter(u->input_filter_ctx, size);
29872995

0 commit comments

Comments
 (0)