net.server_select: remove unused one-letter loop variables [luacheck]
[prosody.git] / net / server_select.lua
index 52a0d5f1a1fd572d81609f76640f926886188891..85730e73c4d2d6c216d9ec062ab97926b6cf56a2 100644 (file)
@@ -38,7 +38,6 @@ local coroutine = use "coroutine"
 
 --// lua lib methods //--
 
-local os_difftime = os.difftime
 local math_min = math.min
 local math_huge = math.huge
 local table_concat = table.concat
@@ -865,7 +864,7 @@ loop = function(once) -- this is the main loop of the program
        local next_timer_time = math_huge;
        repeat
                local read, write, err = socket_select( _readlist, _sendlist, math_min(_selecttimeout, next_timer_time) )
-               for i, socket in ipairs( write ) do -- send data waiting in writequeues
+               for _, socket in ipairs( write ) do -- send data waiting in writequeues
                        local handler = _socketlist[ socket ]
                        if handler then
                                handler.sendbuffer( )
@@ -874,7 +873,7 @@ loop = function(once) -- this is the main loop of the program
                                out_put "server.lua: found no handler and closed socket (writelist)"    -- this should not happen
                        end
                end
-               for i, socket in ipairs( read ) do -- receive data
+               for _, socket in ipairs( read ) do -- receive data
                        local handler = _socketlist[ socket ]
                        if handler then
                                handler.readbuffer( )
@@ -891,17 +890,16 @@ loop = function(once) -- this is the main loop of the program
                _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?