diff --git a/server/channelserver/handlers_stage.go b/server/channelserver/handlers_stage.go index d0468fb8c..64a1153ef 100644 --- a/server/channelserver/handlers_stage.go +++ b/server/channelserver/handlers_stage.go @@ -361,7 +361,7 @@ func handleMsgSysWaitStageBinary(s *Session, p mhfpacket.MHFPacket) { doAckBufSucceed(s, pkt.AckHandle, []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) return } - for { + for i := 0; i < 10; i++ { s.logger.Debug("MsgSysWaitStageBinary before lock and get stage") stage.Lock() stageBinary, gotBinary := stage.rawBinaryData[stageBinaryKey{pkt.BinaryType0, pkt.BinaryType1}] @@ -369,13 +369,15 @@ func handleMsgSysWaitStageBinary(s *Session, p mhfpacket.MHFPacket) { s.logger.Debug("MsgSysWaitStageBinary after lock and get stage") if gotBinary { doAckBufSucceed(s, pkt.AckHandle, stageBinary) - break + return } else { s.logger.Debug("Waiting stage binary", zap.Uint8("BinaryType0", pkt.BinaryType0), zap.Uint8("pkt.BinaryType1", pkt.BinaryType1)) time.Sleep(1 * time.Second) continue } } + s.logger.Warn("MsgSysWaitStageBinary stage binary timeout") + doAckBufSucceed(s, pkt.AckHandle, []byte{}) } else { s.logger.Warn("Failed to get stage", zap.String("StageID", pkt.StageID)) }