伪代码
当然啦,如果有不同的任务,最好把 if need_check_mail then 这里封装成 task_list ,循环检查。
need_check_mail = false
check_mail_task_id = nil
while true do
local data, typ, err = wb:recv_frame()
-- 发送mail
-- 如果很快成功,直接 wb:send_text 否则 设置 need_check_mail 和 check_mail_task_id
if need_check_mail then
-- 检查 mail 是否done
end
done
PS. 貌似 这样搞得跟 nginx 自己的事件循环有点相似了。。。
请慎用哈。。