sniperHW / chuck

high performance and easily use asynchronous network library for C/Lua
52 stars 32 forks source link

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

Open aoktian opened 5 years ago

aoktian commented 5 years ago

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

sniperHW commented 5 years ago

例如这样?

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

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

end)

aoktian commented 5 years ago

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

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

上面三个报错的话调用 errCall

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

sniperHW commented 5 years ago

那是逻辑处理框架的事,不宜放到网络层框架去。

发自我的 iPhone

在 2018年11月21日,11:59,aoktian notifications@github.com 写道:

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

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

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.