Changeset

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
parents 8004:5b5c0142fc46
children 8007:67f8954875a4
files net/server_epoll.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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