Software /
code /
prosody
Comparison
net/server_epoll.lua @ 7585:b64218c816de
net.server_epoll: Improve string representation of connections
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 Aug 2016 15:57:22 +0200 |
parent | 7584:98ee3ed105cf |
child | 7586:846fdbbc62ba |
comparison
equal
deleted
inserted
replaced
7584:98ee3ed105cf | 7585:b64218c816de |
---|---|
112 | 112 |
113 local interface = {}; | 113 local interface = {}; |
114 local interface_mt = { __index = interface }; | 114 local interface_mt = { __index = interface }; |
115 | 115 |
116 function interface_mt:__tostring() | 116 function interface_mt:__tostring() |
117 if self.peername then | 117 if self.sockname and self.peername then |
118 if self.conn then | 118 return ("FD %d (%s, %d, %s, %d)"):format(self:getfd(), self.peername, self.peerport, self.sockname, self.sockport); |
119 return ("%d %s [%s]:%d"):format(self:getfd(), tostring(self.conn), self.peer[1], self.peer[2]); | 119 elseif self.sockname or self.peername then |
120 else | 120 return ("FD %d (%s, %d)"):format(self:getfd(), self.sockname or self.peername, self.sockport or self.peerport); |
121 return ("%d [%s]:%d"):format(self:getfd(), self.peername, self.peerport); | 121 end |
122 end | 122 return ("%s FD %d"):format(tostring(self.conn), self:getfd()); |
123 end | |
124 return tostring(self:getfd()); | |
125 end | 123 end |
126 | 124 |
127 function interface:setlistener(listeners) | 125 function interface:setlistener(listeners) |
128 self.listeners = listeners; | 126 self.listeners = listeners; |
129 end | 127 end |