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

This commit is contained in:
昔念
2026-02-07 14:59:22 +08:00
parent ac3fb4d392
commit ce2c381116
2 changed files with 7 additions and 3 deletions

View File

@@ -233,12 +233,16 @@ func (h *ClientData) OnEvent(v []byte) {
}
func (p *ClientData) SendPack(b []byte) error {
if _, ok := p.Conn.Context().(*ClientData); !ok {
cli, ok := p.Conn.Context().(*ClientData)
if !ok {
return fmt.Errorf("链接错误,取消发包")
}
if cli.Wsmsg == nil {
return fmt.Errorf("ws空")
}
if p.Conn.Context().(*ClientData).Wsmsg.Upgraded {
if cli.Wsmsg.Upgraded {
// This is the echo server
err := wsutil.WriteServerMessage(p.Conn, ws.OpBinary, b)
if err != nil {

View File

@@ -29,7 +29,7 @@ func (p *Player) Save() {
p.Info.OnlineTime = p.Info.OnlineTime + (newtime-uint32(p.Logintime))/60 //每次退出时候保存已经在线的分钟数
if p.FightC != nil {
go p.FightC.Over(p, info.BattleOverReason.PlayerOffline) //玩家逃跑,但是不能锁线程
defer p.FightC.Over(p, info.BattleOverReason.PlayerOffline) //玩家逃跑,但是不能锁线程
}
p.IsLogin = false