1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-04 19:43:05 +08:00
parent 66e59be70b
commit 7589306faa
3 changed files with 24 additions and 25 deletions

View File

@@ -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