local function send_sock()
local sock = ngx.socket.tcp()
sock:settimeout(15000)
local ok,err = sock:connect("127.0.0.1",7001)
if not ok then
ngx.say("failed to connect to 7001",err)
return
end
local bytes, err = sock:send(so_data)
local ok, err = sock:setkeepalive(0,300)
if not ok then
ngx.say("failed to keepalive ",err)
end
end
for i =1,200 do
ngx.thread.spawn(send_sock)
end
把sock实例放进fuction里了
这个keepalive直接
failed to keepalive connection in dubious state
failed to keepalive connection in dubious state
failed to keepalive connection in dubious state