Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在每个事件执行前后加上 beforecall, aftercall,errcall 就好了 #28

Open
aoktian opened this issue Nov 21, 2018 · 3 comments
Open

Comments

@aoktian
Copy link

aoktian commented Nov 21, 2018

在lua注册上beforecall, aftercall,errcall
当执行事件的时候去调用

@sniperHW
Copy link
Owner

例如这样?

conn:Start(event_loop,function (data,err)

if err then
	errcall(err)
else
	beforecall()
	//处理data
	aftercall()
end

end)

@aoktian
Copy link
Author

aoktian commented Nov 21, 2018

我们原先有个项目的做法是在lua中定义三个函数
beforeCall, afterCall, errCall

c 里面在执行网络事件或者定时器事件的时候调用,
调用beforeCall
执行事件
调用afterCall

上面三个报错的话调用 errCall

lua 里面的这几个函数主要就是做统计,数据库提交和回滚

@sniperHW
Copy link
Owner

sniperHW commented Nov 21, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants