summaryrefslogtreecommitdiff
path: root/tests/modules/socket
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-04 00:58:36 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit0c3f6069c16dbc7b6612fb792cbe6b990a7acef2 (patch)
treedde9571fe643e4b70e4a52ba68762e815757655c /tests/modules/socket
parentff45e17b26152544961e52671d61aa5f8e838d38 (diff)
remove scheduler.runloop in outside
Diffstat (limited to 'tests/modules/socket')
-rw-r--r--tests/modules/socket/sched_tcp/echo_client.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/modules/socket/sched_tcp/echo_client.lua b/tests/modules/socket/sched_tcp/echo_client.lua
index 6dfd92439..acc681584 100644
--- a/tests/modules/socket/sched_tcp/echo_client.lua
+++ b/tests/modules/socket/sched_tcp/echo_client.lua
@@ -50,11 +50,12 @@ function _session(addr, port)
end
function main(count)
+ local cotasks = {}
count = count and tonumber(count) or 1
for i = 1, count do
- scheduler.co_start(_session, "127.0.0.1", 9001)
+ table.insert(cotasks, scheduler.co_start(_session, "127.0.0.1", 9001))
end
- scheduler.runloop()
+ scheduler.co_waitexit(cotasks)
for _, sock in ipairs(socks) do
sock:close()
end