aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-12-14 18:11:51 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-12-14 18:11:51 +0100
commit6fcf6209e05410d5ac077ecce6c940197d430c8a (patch)
tree77ce39cedae470dc21f564195cf9bad448bb3a20
parent3c41b0adf7a3175fd7be50d723d51d20f36768d8 (diff)
parent21b795f826f5d2d36d45677f1e6c4118ef850846 (diff)
downloadlua_async-6fcf6209e05410d5ac077ecce6c940197d430c8a.tar.xz
Merge branch 'master' of https://github.com/EliasFleckenstein03/lua_asyncHEADmaster
-rw-r--r--init.lua10
-rw-r--r--promises.lua1
2 files changed, 6 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index 4de726a..8449a0f 100644
--- a/init.lua
+++ b/init.lua
@@ -2,10 +2,6 @@ lua_async = {
poll_functions = {},
}
-if rawget(_G, "require") then
- lua_async.socket = require("socket")
-end
-
function lua_async.clock()
return lua_async.socket and lua_async.socket.gettime() or os.clock()
end
@@ -30,7 +26,11 @@ function lua_async.step(dtime)
-- close phase is obsolete
end
-return function(path)
+return function(path, no_socket)
+ if not no_socket then
+ lua_async.socket = require("socket")
+ end
+
for _, f in ipairs {
"timeouts",
"intervals",
diff --git a/promises.lua b/promises.lua
index 29bcdab..e654458 100644
--- a/promises.lua
+++ b/promises.lua
@@ -39,6 +39,7 @@ function PromisePrototype:__reject_raw(reason)
local any_child = false
for _, child in ipairs(self.__children) do
+ any_child = true
child:reject(reason)
end