Software /
code /
prosody
Comparison
net/server_epoll.lua @ 9383:3260902a5b22
net.server_epoll: Factor out IP/port detection into its own method
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Sep 2018 13:53:18 +0200 |
parent | 9382:31a2be28729c |
child | 9384:5c8006ce8cb8 |
comparison
equal
deleted
inserted
replaced
9382:31a2be28729c | 9383:3260902a5b22 |
---|---|
499 read_size = read_size or (server and server.read_size); | 499 read_size = read_size or (server and server.read_size); |
500 writebuffer = {}; | 500 writebuffer = {}; |
501 tls_ctx = tls_ctx; | 501 tls_ctx = tls_ctx; |
502 }, interface_mt); | 502 }, interface_mt); |
503 | 503 |
504 local ok, peername, peerport = pcall(client.getpeername, client); | 504 conn:updatenames(); |
505 return conn; | |
506 end | |
507 | |
508 function interface:updatenames() | |
509 local conn = self.conn; | |
510 local ok, peername, peerport = pcall(conn.getpeername, conn); | |
505 if ok then | 511 if ok then |
506 conn.peername, conn.peerport = peername, peerport; | 512 self.peername, self.peerport = peername, peerport; |
507 end | 513 end |
508 local ok, sockname, sockport = pcall(client.getsockname, client); | 514 local ok, sockname, sockport = pcall(conn.getsockname, conn); |
509 if ok then | 515 if ok then |
510 conn.sockname, conn.sockport = sockname, sockport; | 516 self.sockname, self.sockport = sockname, sockport; |
511 end | 517 end |
512 return conn; | |
513 end | 518 end |
514 | 519 |
515 -- A server interface has new incoming connections waiting | 520 -- A server interface has new incoming connections waiting |
516 -- This replaces the onreadable callback | 521 -- This replaces the onreadable callback |
517 function interface:onacceptable() | 522 function interface:onacceptable() |