Comparison

net/server_select.lua @ 7477:f9e470026042

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jul 2016 22:01:10 +0200
parent 7324:7e6409462f79
parent 7468:2d38a2519d09
child 7505:3d950ee0de35
comparison
equal deleted inserted replaced
7467:9a73c85baffe 7477:f9e470026042
902 local t = _timerlist[ i ]( _currenttime ) -- fire timers 902 local t = _timerlist[ i ]( _currenttime ) -- fire timers
903 if t then next_timer_time = math_min(next_timer_time, t); end 903 if t then next_timer_time = math_min(next_timer_time, t); end
904 end 904 end
905 905
906 local read, write, err = socket_select( _readlist, _sendlist, math_min(_selecttimeout, next_timer_time) ) 906 local read, write, err = socket_select( _readlist, _sendlist, math_min(_selecttimeout, next_timer_time) )
907 for i, socket in ipairs( write ) do -- send data waiting in writequeues 907 for _, socket in ipairs( write ) do -- send data waiting in writequeues
908 local handler = _socketlist[ socket ] 908 local handler = _socketlist[ socket ]
909 if handler then 909 if handler then
910 handler.sendbuffer( ) 910 handler.sendbuffer( )
911 else 911 else
912 closesocket( socket ) 912 closesocket( socket )
913 out_put "server.lua: found no handler and closed socket (writelist)" -- this should not happen 913 out_put "server.lua: found no handler and closed socket (writelist)" -- this should not happen
914 end 914 end
915 end 915 end
916 for i, socket in ipairs( read ) do -- receive data 916 for _, socket in ipairs( read ) do -- receive data
917 local handler = _socketlist[ socket ] 917 local handler = _socketlist[ socket ]
918 if handler then 918 if handler then
919 handler.readbuffer( ) 919 handler.readbuffer( )
920 else 920 else
921 closesocket( socket ) 921 closesocket( socket )