Skip to content

Commit

Permalink
do not change metatable to avoid conflicts with possible other
Browse files Browse the repository at this point in the history
monkypatches on `ngx.socket.tcp`
  • Loading branch information
dndx committed Nov 24, 2020
1 parent 761c1f0 commit d23ebac
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/resty/core/socket_tcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ local FFI_NO_REQ_CTX = base.FFI_NO_REQ_CTX
local get_request = base.get_request
local error = error
local assert = assert
local getmetatable = getmetatable
local type = type
local pcall = pcall
local select = select
Expand Down Expand Up @@ -178,12 +177,8 @@ do
error(sock, 2)
end

local mt = getmetatable(sock)

mt.tlshandshake = tlshandshake
mt.sslhandshake = sslhandshake

ngx.socket.tcp = old_socket_tcp
sock.tlshandshake = tlshandshake
sock.sslhandshake = sslhandshake

return sock
end
Expand Down

0 comments on commit d23ebac

Please sign in to comment.