openresty / stream-lua-nginx-module

Embed the power of Lua into NGINX TCP/UDP servers
BSD 2-Clause "Simplified" License
728 stars 198 forks source link

bugfix: correctly error out when ngx.socket.tcp is shutdown before connect #331

Closed fffonion closed 11 months ago

fffonion commented 12 months ago

Can be reproduced by following example:

user www-data;
daemon off;
master_process off;

events {
}

stream {
    error_log /dev/stdout info;
    server {
        listen 23333;
            content_by_lua_block {
                        local t = ngx.socket.tcp()
                        t:shutdown("send")
            }
    }
}

This PR moves the check of u before calling ngx_stream_lua_socket_handle_write_error.

tzssangglass commented 11 months ago

make sense

fffonion commented 11 months ago

Thank you!