This commit is contained in:
@@ -63,7 +63,7 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) {
|
||||
|
||||
//logging.Infof("conn[%v] disconnected", c.RemoteAddr().String())
|
||||
v, _ := c.Context().(*player.ClientData)
|
||||
v.LF.Close()
|
||||
v.LF.Close() //关闭继续接受
|
||||
if v.Player != nil {
|
||||
v.Player.Save() //保存玩家数据
|
||||
|
||||
@@ -153,7 +153,11 @@ func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action) {
|
||||
|
||||
t := c.Context().(*player.ClientData)
|
||||
for _, msg := range messages {
|
||||
t.LF.Producer().Write(msg.Payload)
|
||||
|
||||
if t.LF.Running() {
|
||||
t.LF.Producer().Write(msg.Payload)
|
||||
}
|
||||
|
||||
//t.OnEvent(msg.Payload)
|
||||
}
|
||||
|
||||
@@ -177,7 +181,10 @@ func (s *Server) handleTCP(conn gnet.Conn) (action gnet.Action) {
|
||||
}
|
||||
|
||||
if t, ok := conn.Context().(*player.ClientData); ok {
|
||||
t.LF.Producer().Write(data)
|
||||
if t.LF.Running() {
|
||||
t.LF.Producer().Write(data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if conn.InboundBuffered() > 0 {
|
||||
|
||||
Reference in New Issue
Block a user