Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10330:d86b1304451a
net.server_epoll: Handle getpeer/sockname returning a normal error
These will sometimes return nil, "Transport not connected" but not throw
a hard error. This shouldn't be treated as success.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 12 Oct 2019 20:12:04 +0200 |
parent | 10329:c0a72c97e6cf |
child | 10331:76bd77ad6a2a |
comparison
equal
deleted
inserted
replaced
10329:c0a72c97e6cf | 10330:d86b1304451a |
---|---|
603 end | 603 end |
604 | 604 |
605 function interface:updatenames() | 605 function interface:updatenames() |
606 local conn = self.conn; | 606 local conn = self.conn; |
607 local ok, peername, peerport = pcall(conn.getpeername, conn); | 607 local ok, peername, peerport = pcall(conn.getpeername, conn); |
608 if ok then | 608 if ok and peername then |
609 self.peername, self.peerport = peername, peerport; | 609 self.peername, self.peerport = peername, peerport; |
610 end | 610 end |
611 local ok, sockname, sockport = pcall(conn.getsockname, conn); | 611 local ok, sockname, sockport = pcall(conn.getsockname, conn); |
612 if ok then | 612 if ok and sockname then |
613 self.sockname, self.sockport = sockname, sockport; | 613 self.sockname, self.sockport = sockname, sockport; |
614 end | 614 end |
615 end | 615 end |
616 | 616 |
617 -- A server interface has new incoming connections waiting | 617 -- A server interface has new incoming connections waiting |