diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index cd91fce0..9751fa45 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -501,15 +501,20 @@ local function wrapsocket(client, server, read_size, listeners, tls_ctx) -- luas tls_ctx = tls_ctx; }, interface_mt); - local ok, peername, peerport = pcall(client.getpeername, client); + conn:updatenames(); + return conn; +end + +function interface:updatenames() + local conn = self.conn; + local ok, peername, peerport = pcall(conn.getpeername, conn); if ok then - conn.peername, conn.peerport = peername, peerport; + self.peername, self.peerport = peername, peerport; end - local ok, sockname, sockport = pcall(client.getsockname, client); + local ok, sockname, sockport = pcall(conn.getsockname, conn); if ok then - conn.sockname, conn.sockport = sockname, sockport; + self.sockname, self.sockport = sockname, sockport; end - return conn; end -- A server interface has new incoming connections waiting |