Skip to content

Commit 8d4d81b

Browse files
committed
do not change metatable to avoid conflicts with possible other
monkypatches on `ngx.socket.tcp`
1 parent d27f2af commit 8d4d81b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/resty/core/socket_tcp.lua

+2-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ local FFI_NO_REQ_CTX = base.FFI_NO_REQ_CTX
1212
local get_request = base.get_request
1313
local error = error
1414
local assert = assert
15-
local getmetatable = getmetatable
1615
local type = type
1716
local pcall = pcall
1817
local select = select
@@ -178,12 +177,8 @@ do
178177
error(sock, 2)
179178
end
180179

181-
local mt = getmetatable(sock)
182-
183-
mt.tlshandshake = tlshandshake
184-
mt.sslhandshake = sslhandshake
185-
186-
ngx.socket.tcp = old_socket_tcp
180+
sock.tlshandshake = tlshandshake
181+
sock.sslhandshake = sslhandshake
187182

188183
return sock
189184
end

0 commit comments

Comments
 (0)