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 | 02d7dea382e9b0469ba107282b3b31bee0ddcf6d (patch) | |
tree | 9c1f868e753f7edfa47b603bb8af73695de19084 | |
parent | a297b318cf661c57fbb54b0d5cc18f84d583db96 (diff) | |
download | prosody-02d7dea382e9b0469ba107282b3b31bee0ddcf6d.tar.gz prosody-02d7dea382e9b0469ba107282b3b31bee0ddcf6d.zip |
net.server_epoll: Improve string representation of connections
-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) |