From 8e377ca47c1ffd514390988f782f41faa127b31a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 24 May 2013 18:14:09 +0100 Subject: net.server_select: Support for listener.onreadtimeout() [see also e67891ad18d6] --- net/server_select.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'net/server_select.lua') diff --git a/net/server_select.lua b/net/server_select.lua index 7eb330a8..0e7f41f8 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -861,16 +861,16 @@ loop = function(once) -- this is the main loop of the program _starttime = _currenttime for handler, timestamp in pairs( _writetimes ) do if os_difftime( _currenttime - timestamp ) > _sendtimeout then - --_writetimes[ handler ] = nil handler.disconnect( )( handler, "send timeout" ) handler:force_close() -- forced disconnect end end for handler, timestamp in pairs( _readtimes ) do if os_difftime( _currenttime - timestamp ) > _readtimeout then - --_readtimes[ handler ] = nil - handler.disconnect( )( handler, "read timeout" ) - handler:close( ) -- forced disconnect? + if not(handler.onreadtimeout) or handler:onreadtimeout() ~= true then + handler.disconnect( )( handler, "read timeout" ) + handler:close( ) -- forced disconnect? + end end end end -- cgit v1.2.3