This commit is contained in:
@@ -145,13 +145,10 @@ func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action) {
|
||||
}
|
||||
|
||||
t := c.Context().(*player.ClientData)
|
||||
//client := conn.RemoteAddr().String()
|
||||
s.workerPool.Submit(func() { //TODO 这里可能存在顺序执行问题,待修复
|
||||
for _, msg := range messages {
|
||||
t.LF.Producer().Write(msg.Payload)
|
||||
//t.OnEvent(msg.Payload)
|
||||
}
|
||||
})
|
||||
for _, msg := range messages {
|
||||
t.LF.Producer().Write(msg.Payload)
|
||||
//t.OnEvent(msg.Payload)
|
||||
}
|
||||
|
||||
return gnet.None
|
||||
}
|
||||
@@ -172,13 +169,9 @@ func (s *Server) handleTCP(conn gnet.Conn) (action gnet.Action) {
|
||||
|
||||
}
|
||||
|
||||
s.workerPool.Submit(func() { //TODO 这里可能存在顺序执行问题,待修复
|
||||
//conn.Context().(*player.ClientData).OnEvent(data)
|
||||
if t, ok := conn.Context().(*player.ClientData); ok {
|
||||
t.LF.Producer().Write(data)
|
||||
}
|
||||
|
||||
})
|
||||
if t, ok := conn.Context().(*player.ClientData); ok {
|
||||
t.LF.Producer().Write(data)
|
||||
}
|
||||
|
||||
if conn.InboundBuffered() > 0 {
|
||||
if err := conn.Wake(nil); err != nil { // wake up the connection manually to avoid missing the leftover data
|
||||
|
||||
Reference in New Issue
Block a user