From d3d91c224a5c7309283994536aeac6e4702e2e25 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 28 Sep 2013 18:40:48 +0100 Subject: server_select: fix onreadtimeout support so that listeners can override the default (disconnect) behaviour --- net/server_select.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/server_select.lua b/net/server_select.lua index ca55d2d5..4721d6ad 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -284,6 +284,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport 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 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport 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 -- cgit v1.2.3