Software /
code /
prosody
Comparison
net/server_select.lua @ 8749:fb3cd6b2263b
net.server_select: Allow setquitting("once") to allow resuming the loop later
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 10 Apr 2018 20:40:07 +0100 |
parent | 8728:41c959c5c84b |
child | 8781:53178b6ba589 |
comparison
equal
deleted
inserted
replaced
8748:2fdeb979cc7c | 8749:fb3cd6b2263b |
---|---|
887 end | 887 end |
888 | 888 |
889 local quitting; | 889 local quitting; |
890 | 890 |
891 local function setquitting(quit) | 891 local function setquitting(quit) |
892 quitting = not not quit; | 892 quitting = quit; |
893 end | 893 end |
894 | 894 |
895 loop = function(once) -- this is the main loop of the program | 895 loop = function(once) -- this is the main loop of the program |
896 if quitting then return "quitting"; end | 896 if quitting then return "quitting"; end |
897 if once then quitting = "once"; end | 897 if once then quitting = "once"; end |
956 _fullservers[ server ] = nil; | 956 _fullservers[ server ] = nil; |
957 server.resume(); | 957 server.resume(); |
958 end | 958 end |
959 end | 959 end |
960 until quitting; | 960 until quitting; |
961 if once and quitting == "once" then quitting = nil; return; end | 961 if quitting == "once" then quitting = nil; return; end |
962 closeall(); | 962 closeall(); |
963 return "quitting" | 963 return "quitting" |
964 end | 964 end |
965 | 965 |
966 local function step() | 966 local function step() |