mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
fix websocket客户端连接过程中握手失败导致内存泄漏 (#1899)
* fix word err * fix word err * 增加mongo update 测试 * remove unused local variable * fix websocket客户端连接过程中握手失败导致内存泄漏
This commit is contained in:
@@ -14,6 +14,7 @@ local pairs = pairs
|
||||
local error = error
|
||||
local string = string
|
||||
local xpcall = xpcall
|
||||
local pcall = pcall
|
||||
local debug = debug
|
||||
local table = table
|
||||
local tonumber = tonumber
|
||||
@@ -481,7 +482,12 @@ function M.connect(url, header, timeout)
|
||||
local socket_id = sockethelper.connect(host_addr, host_port, timeout)
|
||||
local ws_obj = _new_client_ws(socket_id, protocol, hostname)
|
||||
ws_obj.addr = host
|
||||
write_handshake(ws_obj, host_addr, uri, header)
|
||||
|
||||
local is_ok,err = pcall(write_handshake, ws_obj, host_addr, uri, header)
|
||||
if not is_ok then
|
||||
_close_websocket(ws_obj)
|
||||
error(err)
|
||||
end
|
||||
return socket_id
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user