Changeset

5486:bcf27dbef6c6

net.server_select: Add and improve some comments.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 16 Apr 2013 18:18:22 -0400
parents 5485:5147eed0a42e
children 5487:03ddf2375d48
files net/server_select.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Tue Apr 16 18:15:10 2013 -0400
+++ b/net/server_select.lua	Tue Apr 16 18:18:22 2013 -0400
@@ -847,6 +847,7 @@
 		end
 		_currenttime = luasocket_gettime( )
 
+		-- Check for socket timeouts
 		local difftime = os_difftime( _currenttime - _starttime )
 		if difftime > _checkinterval then
 			_starttime = _currenttime
@@ -866,6 +867,7 @@
 			end
 		end
 
+		-- Fire timers
 		if _currenttime - _timer >= math_min(next_timer_time, 1) then
 			next_timer_time = math_huge;
 			for i = 1, _timerlistlen do
@@ -876,8 +878,9 @@
 		else
 			next_timer_time = next_timer_time - (_currenttime - _timer);
 		end
-		socket_sleep( _sleeptime ) -- wait some time
-		--collectgarbage( )
+
+		-- wait some time (0 by default)
+		socket_sleep( _sleeptime )
 	until quitting;
 	if once and quitting == "once" then quitting = nil; return; end
 	return "quitting"