Diff

net/server_select.lua @ 7323:a1570219b865

net.server_select: Remove do-nothing os_difftime calls [backported from trunk]
author daurnimator <quae@daurnimator.com>
date Mon, 19 Jan 2015 14:01:11 -0500
parent 7098:5286e79c6829
child 7324:7e6409462f79
child 7468:2d38a2519d09
line wrap: on
line diff
--- a/net/server_select.lua	Mon Mar 28 19:56:12 2016 +0200
+++ b/net/server_select.lua	Mon Jan 19 14:01:11 2015 -0500
@@ -38,7 +38,6 @@
 
 --// lua lib methods //--
 
-local os_difftime = os.difftime
 local math_min = math.min
 local math_huge = math.huge
 local table_concat = table.concat
@@ -891,17 +890,16 @@
 		_currenttime = luasocket_gettime( )
 
 		-- Check for socket timeouts
-		local difftime = os_difftime( _currenttime - _starttime )
-		if difftime > _checkinterval then
+		if _currenttime - _starttime > _checkinterval then
 			_starttime = _currenttime
 			for handler, timestamp in pairs( _writetimes ) do
-				if os_difftime( _currenttime - timestamp ) > _sendtimeout then
+				if _currenttime - timestamp > _sendtimeout then
 					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
+				if _currenttime - timestamp > _readtimeout then
 					if not(handler.onreadtimeout) or handler:onreadtimeout() ~= true then
 						handler.disconnect( )( handler, "read timeout" )
 						handler:close( )	-- forced disconnect?