aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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