Diff

net/server_epoll.lua @ 8006:be374a5778f3

net.server_epoll: Log if there's a connection without listeners
author Kim Alvefur <zash@zash.se>
date Mon, 27 Mar 2017 03:40:24 +0200
parent 7910:91db637be237
child 8007:67f8954875a4
line wrap: on
line diff
--- 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