Changeset

13422:3c80124452ed

net.server_epoll: Prevent traceback when checking TLS after connection gone Unclear why this would be done, but an error is not great.
author Kim Alvefur <zash@zash.se>
date Sun, 21 Jan 2024 22:59:50 +0100
parents 13421:92301fa7a673
children 13423:3c219effe707
files net/server_epoll.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Tue Feb 20 17:31:17 2024 +0000
+++ b/net/server_epoll.lua	Sun Jan 21 22:59:50 2024 +0100
@@ -630,30 +630,35 @@
 
 function interface:ssl_info()
 	local sock = self.conn;
+	if not sock then return nil, "not-connected" end
 	if not sock.info then return nil, "not-implemented"; end
 	return sock:info();
 end
 
 function interface:ssl_peercertificate()
 	local sock = self.conn;
+	if not sock then return nil, "not-connected" end
 	if not sock.getpeercertificate then return nil, "not-implemented"; end
 	return sock:getpeercertificate();
 end
 
 function interface:ssl_peerverification()
 	local sock = self.conn;
+	if not sock then return nil, "not-connected" end
 	if not sock.getpeerverification then return nil, { { "Chain verification not supported" } }; end
 	return sock:getpeerverification();
 end
 
 function interface:ssl_peerfinished()
 	local sock = self.conn;
+	if not sock then return nil, "not-connected" end
 	if not sock.getpeerfinished then return nil, "not-implemented"; end
 	return sock:getpeerfinished();
 end
 
 function interface:ssl_exportkeyingmaterial(label, len, context)
 	local sock = self.conn;
+	if not sock then return nil, "not-connected" end
 	if sock.exportkeyingmaterial then
 		return sock:exportkeyingmaterial(label, len, context);
 	end