projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net.server_select: Add and improve some comments.
[prosody.git]
/
net
/
server_select.lua
diff --git
a/net/server_select.lua
b/net/server_select.lua
index 86c9daef24ae7e8fd63a130a28177b95c9ddde05..983b06a20daeec9d6b9ed8cee0781c47c72a35c8 100644
(file)
--- a/
net/server_select.lua
+++ b/
net/server_select.lua
@@
-847,6
+847,7
@@
loop = function(once) -- this is the main loop of the program
end
_currenttime = luasocket_gettime( )
end
_currenttime = luasocket_gettime( )
+ -- Check for socket timeouts
local difftime = os_difftime( _currenttime - _starttime )
if difftime > _checkinterval then
_starttime = _currenttime
local difftime = os_difftime( _currenttime - _starttime )
if difftime > _checkinterval then
_starttime = _currenttime
@@
-866,6
+867,7
@@
loop = function(once) -- this is the main loop of the program
end
end
end
end
+ -- Fire timers
if _currenttime - _timer >= math_min(next_timer_time, 1) then
next_timer_time = math_huge;
for i = 1, _timerlistlen do
if _currenttime - _timer >= math_min(next_timer_time, 1) then
next_timer_time = math_huge;
for i = 1, _timerlistlen do
@@
-876,8
+878,9
@@
loop = function(once) -- this is the main loop of the program
else
next_timer_time = next_timer_time - (_currenttime - _timer);
end
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"
until quitting;
if once and quitting == "once" then quitting = nil; return; end
return "quitting"