net.server_epoll: Log if there's a connection without listeners
authorKim Alvefur <zash@zash.se>
Mon, 27 Mar 2017 03:40:24 +0200
changeset 8009 be374a5778f3
parent 8007 5b5c0142fc46
child 8010 67f8954875a4
net.server_epoll: Log if there's a connection without listeners
net/server_epoll.lua
--- a/net/server_epoll.lua	Fri Mar 24 00:32:09 2017 +0100
+++ b/net/server_epoll.lua	Mon Mar 27 03:40:24 2017 +0200
@@ -143,6 +143,10 @@
 
 -- Call a listener callback
 function interface:on(what, ...)
+	if not self.listeners then
+		log("error", "%s has no listeners", self);
+		return;
+	end
 	local listener = self.listeners["on"..what];
 	if not listener then
 		-- log("debug", "Missing listener 'on%s'", what); -- uncomment for development and debugging