We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 759160e commit d9be189Copy full SHA for d9be189
lib/resty/core/socket_tcp.lua
@@ -14,6 +14,7 @@ local error = error
14
local assert = assert
15
local getmetatable = getmetatable
16
local type = type
17
+local pcall = pcall
18
local select = select
19
local co_yield = coroutine._yield
20
local table_new = require("table.new")
@@ -172,7 +173,11 @@ do
172
173
local old_socket_tcp = ngx.socket.tcp
174
175
function ngx.socket.tcp()
- local sock = old_socket_tcp()
176
+ local ok, sock = pcall(old_socket_tcp)
177
+ if not ok then
178
+ error(sock, 2)
179
+ end
180
+
181
local mt = getmetatable(sock)
182
183
mt.tlshandshake = tlshandshake
0 commit comments