Changeset

5846:b8c7656481ac

server_select: fix onreadtimeout support so that listeners can override the default (disconnect) behaviour
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Sep 2013 18:40:48 +0100
parents 5845:c48f717c2fd6
children 5847:6aaa7ad4463c
files net/server_select.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Thu Sep 26 16:55:39 2013 +0200
+++ b/net/server_select.lua	Sat Sep 28 18:40:48 2013 +0100
@@ -284,6 +284,7 @@
 	local status = listeners.onstatus
 	local disconnect = listeners.ondisconnect
 	local drain = listeners.ondrain
+	local onreadtimeout = listeners.onreadtimeout;
 
 	local bufferqueue = { } -- buffer array
 	local bufferqueuelen = 0	-- end of buffer array
@@ -312,11 +313,14 @@
 	handler.disconnect = function( )
 		return disconnect
 	end
+	handler.onreadtimeout = onreadtimeout;
+
 	handler.setlistener = function( self, listeners )
 		dispatch = listeners.onincoming
 		disconnect = listeners.ondisconnect
 		status = listeners.onstatus
 		drain = listeners.ondrain
+		handler.onreadtimeout = listeners.onreadtimeout
 	end
 	handler.getstats = function( )
 		return readtraffic, sendtraffic