网关广播socket包优化
#2106
Replies: 2 comments 1 reply
-
|
可以参考这个网关的实现?cb 函数 return 1 时,数据就不会 free ,自己广播完之后手动 free 。 skynet/service-src/service_gate.c Lines 281 to 312 in 5608d39 |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
我目前的做法是在广播和组播包时设计专门的打包接口,将其转为字符串模式以实现共享,不然会因多次释放包数据而崩溃。但不确认此方案是否合理。 function M.pack_down_all_tostring(msg_id, data, seq, encrypt_, handle)
local data, sz = M.pack_down_all(msg_id, data, seq, encrypt_, handle)
return netpack.tostring(data, sz)
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
请教网关服务广播socket包时如何优化打包过程(避免pb和websocket等多次打包)?
Beta Was this translation helpful? Give feedback.
All reactions