-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
请问如何保证数据有序性? #833
Comments
Go的net.Conn是并发安全的,看官方文档。你保证你发送的数据一次调用发送就行。 |
非常感谢作者及时耐心解答,祝您万事顺心! |
游戏业务中有类似请求保序的场景,需要针对请求中同一个 player_id 的数据做顺序串行处理,相当于一个玩家一个队列,对于这样的场景大佬有什么建议吗,当前框架的 WorkerPool 好像不太好做这样的扩展(没法指定 key)。 @smallnest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在func (s *Server) serveConn(conn net.Conn) {
}
而在processOneRequest中,包含了发送相应的过程,即s.sendResponse(ctx, conn, err, req, res),在多协程(可能处于不同的线程环境中)情况下,对同一个socket发送数据,如何保证数据的一致性,比如协程A发送了几个字节,协程B发送了几个字节,然后协程A再发送几个字节。
The text was updated successfully, but these errors were encountered: