mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 15:04:38 +01:00
implement SysWaitStageBinary timeout
This commit is contained in:
@@ -361,7 +361,7 @@ func handleMsgSysWaitStageBinary(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
doAckBufSucceed(s, pkt.AckHandle, []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for {
|
for i := 0; i < 10; i++ {
|
||||||
s.logger.Debug("MsgSysWaitStageBinary before lock and get stage")
|
s.logger.Debug("MsgSysWaitStageBinary before lock and get stage")
|
||||||
stage.Lock()
|
stage.Lock()
|
||||||
stageBinary, gotBinary := stage.rawBinaryData[stageBinaryKey{pkt.BinaryType0, pkt.BinaryType1}]
|
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")
|
s.logger.Debug("MsgSysWaitStageBinary after lock and get stage")
|
||||||
if gotBinary {
|
if gotBinary {
|
||||||
doAckBufSucceed(s, pkt.AckHandle, stageBinary)
|
doAckBufSucceed(s, pkt.AckHandle, stageBinary)
|
||||||
break
|
return
|
||||||
} else {
|
} else {
|
||||||
s.logger.Debug("Waiting stage binary", zap.Uint8("BinaryType0", pkt.BinaryType0), zap.Uint8("pkt.BinaryType1", pkt.BinaryType1))
|
s.logger.Debug("Waiting stage binary", zap.Uint8("BinaryType0", pkt.BinaryType0), zap.Uint8("pkt.BinaryType1", pkt.BinaryType1))
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s.logger.Warn("MsgSysWaitStageBinary stage binary timeout")
|
||||||
|
doAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||||
} else {
|
} else {
|
||||||
s.logger.Warn("Failed to get stage", zap.String("StageID", pkt.StageID))
|
s.logger.Warn("Failed to get stage", zap.String("StageID", pkt.StageID))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user