Software /
code /
prosody
Comparison
net/server_epoll.lua @ 8271:c09deab9989e
net.server_epoll: Add interface:server() method to match server_event (fixes c2s:show traceback in telnet console)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 29 Sep 2017 10:50:27 +0200 |
parent | 8091:acecf1413233 |
child | 8506:174fd716c9fa |
comparison
equal
deleted
inserted
replaced
8270:8b470cf497b7 | 8271:c09deab9989e |
---|---|
165 return self.conn:getfd(); | 165 return self.conn:getfd(); |
166 end | 166 end |
167 return _SOCKETINVALID; | 167 return _SOCKETINVALID; |
168 end | 168 end |
169 | 169 |
170 function interface:server() | |
171 return self._server or self; | |
172 end | |
173 | |
170 -- Get IP address | 174 -- Get IP address |
171 function interface:ip() | 175 function interface:ip() |
172 return self.peername or self.sockname; | 176 return self.peername or self.sockname; |
173 end | 177 end |
174 | 178 |
184 | 188 |
185 -- Get remote port | 189 -- Get remote port |
186 function interface:serverport() | 190 function interface:serverport() |
187 if self.sockport then | 191 if self.sockport then |
188 return self.sockport; | 192 return self.sockport; |
189 elseif self.server then | 193 elseif self._server then |
190 self.server:port(); | 194 self._server:port(); |
191 end | 195 end |
192 end | 196 end |
193 | 197 |
194 -- Return underlying socket | 198 -- Return underlying socket |
195 function interface:socket() | 199 function interface:socket() |
463 | 467 |
464 local function wrapsocket(client, server, pattern, listeners, tls) -- luasocket object -> interface object | 468 local function wrapsocket(client, server, pattern, listeners, tls) -- luasocket object -> interface object |
465 client:settimeout(0); | 469 client:settimeout(0); |
466 local conn = setmetatable({ | 470 local conn = setmetatable({ |
467 conn = client; | 471 conn = client; |
468 server = server; | 472 _server = server; |
469 created = gettime(); | 473 created = gettime(); |
470 listeners = listeners; | 474 listeners = listeners; |
471 _pattern = pattern or (server and server._pattern); | 475 _pattern = pattern or (server and server._pattern); |
472 writebuffer = {}; | 476 writebuffer = {}; |
473 tls = tls; | 477 tls = tls; |