Comparison

net/server_epoll.lua @ 10854:472fe13a05f9

net.server_epoll: Handle missing ports from getsock/peername (as in the case of unix sockets)
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Jun 2020 14:26:11 +0100
parent 10847:42c8dce6e765
child 10861:e12690a37795
comparison
equal deleted inserted replaced
10853:0107ed6744aa 10854:472fe13a05f9
617 617
618 function interface:updatenames() 618 function interface:updatenames()
619 local conn = self.conn; 619 local conn = self.conn;
620 local ok, peername, peerport = pcall(conn.getpeername, conn); 620 local ok, peername, peerport = pcall(conn.getpeername, conn);
621 if ok and peername then 621 if ok and peername then
622 self.peername, self.peerport = peername, peerport; 622 self.peername, self.peerport = peername, peerport or 0;
623 end 623 end
624 local ok, sockname, sockport = pcall(conn.getsockname, conn); 624 local ok, sockname, sockport = pcall(conn.getsockname, conn);
625 if ok and sockname then 625 if ok and sockname then
626 self.sockname, self.sockport = sockname, sockport; 626 self.sockname, self.sockport = sockname, sockport or 0;
627 end 627 end
628 end 628 end
629 629
630 -- A server interface has new incoming connections waiting 630 -- A server interface has new incoming connections waiting
631 -- This replaces the onreadable callback 631 -- This replaces the onreadable callback