Software /
code /
prosody
Diff
net/server_select.lua @ 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 |
parent | 5824:6f4c8af128e2 |
child | 5950:bd1d1c29a7e7 |
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