fix(crashes): trying to investigate the causes of crash.

New unit tests to that end.
This commit is contained in:
Houmgaor
2025-10-19 19:02:29 +02:00
parent 02d5195611
commit 8a92a7957e
9 changed files with 1699 additions and 19 deletions

View File

@@ -31,7 +31,7 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
diff, err := nullcomp.Decompress(pkt.RawDataPayload)
if err != nil {
s.logger.Error("Failed to decompress diff", zap.Error(err))
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
return
}
// Perform diff.
@@ -43,7 +43,7 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
saveData, err := nullcomp.Decompress(pkt.RawDataPayload)
if err != nil {
s.logger.Error("Failed to decompress savedata from packet", zap.Error(err))
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
return
}
if s.server.erupeConfig.SaveDumps.RawEnabled {
@@ -177,6 +177,8 @@ func handleMsgMhfSaveScenarioData(s *Session, p mhfpacket.MHFPacket) {
_, err := s.server.db.Exec("UPDATE characters SET scenariodata = $1 WHERE id = $2", pkt.RawDataPayload, s.charID)
if err != nil {
s.logger.Error("Failed to update scenario data in db", zap.Error(err))
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
return
}
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
}