Changeset

5632:8a2456f1f117

net.server_select: Support for listener.onreadtimeout() [see also e67891ad18d6]
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 May 2013 18:14:09 +0100
parents 5631:78bc91f0d74b
children 5633:d999027577ed
files net/server_select.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Sun May 26 22:59:06 2013 +0200
+++ b/net/server_select.lua	Fri May 24 18:14:09 2013 +0100
@@ -861,16 +861,16 @@
 			_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