diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-18 15:57:22 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-18 15:57:22 +0200 |
commit | 0d62fa9d6938e623a693160f2a0fc32dda1e816d (patch) | |
tree | 9c1f868e753f7edfa47b603bb8af73695de19084 /net | |
parent | 57511e200f68478411fdb79f836f87085cf4d33d (diff) | |
download | prosody-0d62fa9d6938e623a693160f2a0fc32dda1e816d.tar.gz prosody-0d62fa9d6938e623a693160f2a0fc32dda1e816d.zip |
net.server_epoll: Improve string representation of connections
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index d661d53a..f4ec54f6 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -114,14 +114,12 @@ local interface = {}; local interface_mt = { __index = interface }; function interface_mt:__tostring() - if self.peername then - if self.conn then - return ("%d %s [%s]:%d"):format(self:getfd(), tostring(self.conn), self.peer[1], self.peer[2]); - else - return ("%d [%s]:%d"):format(self:getfd(), self.peername, self.peerport); - end + if self.sockname and self.peername then + return ("FD %d (%s, %d, %s, %d)"):format(self:getfd(), self.peername, self.peerport, self.sockname, self.sockport); + elseif self.sockname or self.peername then + return ("FD %d (%s, %d)"):format(self:getfd(), self.sockname or self.peername, self.sockport or self.peerport); end - return tostring(self:getfd()); + return ("%s FD %d"):format(tostring(self.conn), self:getfd()); end function interface:setlistener(listeners) |