aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/dispatch.lua5
-rw-r--r--test/utestclnt.lua8
2 files changed, 6 insertions, 7 deletions
diff --git a/etc/dispatch.lua b/etc/dispatch.lua
index cc8cb23..f35f358 100644
--- a/etc/dispatch.lua
+++ b/etc/dispatch.lua
@@ -50,7 +50,7 @@ function socket.protect(f)
50 return function(...) 50 return function(...)
51 local co = coroutine.create(f) 51 local co = coroutine.create(f)
52 while true do 52 while true do
53 local results = {coroutine.resume(co, base.unpack(arg))} 53 local results = {coroutine.resume(co, ...)}
54 local status = table.remove(results, 1) 54 local status = table.remove(results, 1)
55 if not status then 55 if not status then
56 if base.type(results[1]) == 'table' then 56 if base.type(results[1]) == 'table' then
@@ -104,8 +104,7 @@ local function cowrap(dispatcher, tcp, error)
104 -- don't override explicitly. 104 -- don't override explicitly.
105 local metat = { __index = function(table, key) 105 local metat = { __index = function(table, key)
106 table[key] = function(...) 106 table[key] = function(...)
107 arg[1] = tcp 107 return tcp[key](tcp,select(2,...))
108 return tcp[key](base.unpack(arg))
109 end 108 end
110 return table[key] 109 return table[key]
111 end} 110 end}
diff --git a/test/utestclnt.lua b/test/utestclnt.lua
index eec6adc..01f55e5 100644
--- a/test/utestclnt.lua
+++ b/test/utestclnt.lua
@@ -4,24 +4,24 @@ local socket = require"socket.unix"
4host = "luasocket" 4host = "luasocket"
5 5
6function pass(...) 6function pass(...)
7 local s = string.format(unpack(arg)) 7 local s = string.format(...)
8 io.stderr:write(s, "\n") 8 io.stderr:write(s, "\n")
9end 9end
10 10
11function fail(...) 11function fail(...)
12 local s = string.format(unpack(arg)) 12 local s = string.format(...)
13 io.stderr:write("ERROR: ", s, "!\n") 13 io.stderr:write("ERROR: ", s, "!\n")
14socket.sleep(3) 14socket.sleep(3)
15 os.exit() 15 os.exit()
16end 16end
17 17
18function warn(...) 18function warn(...)
19 local s = string.format(unpack(arg)) 19 local s = string.format(...)
20 io.stderr:write("WARNING: ", s, "\n") 20 io.stderr:write("WARNING: ", s, "\n")
21end 21end
22 22
23function remote(...) 23function remote(...)
24 local s = string.format(unpack(arg)) 24 local s = string.format(...)
25 s = string.gsub(s, "\n", ";") 25 s = string.gsub(s, "\n", ";")
26 s = string.gsub(s, "%s+", " ") 26 s = string.gsub(s, "%s+", " ")
27 s = string.gsub(s, "^%s*", "") 27 s = string.gsub(s, "^%s*", "")