fix(channelserver): send ACK on empty Raviente register payload

handleMsgSysOperateRegister returned without sending an ACK when the
payload was empty, causing the client to softlock waiting for a response.
Send doAckBufSucceed with nil data on the early-return path to match
the success-path ACK type.

Also update tests to expect error returns instead of panics from
unimplemented Build/Parse stubs (matching prior panic→error refactor),
and mark resolved anti-patterns in docs.
This commit is contained in:
Houmgaor
2026-02-20 20:05:52 +01:00
parent ac59188488
commit a752c5187e
5 changed files with 21 additions and 29 deletions

View File

@@ -400,16 +400,13 @@ func TestMsgBinChatAllTypes(t *testing.T) {
}
}
func TestMsgBinMailNotifyParsePanics(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Error("Parse() should panic with 'implement me'")
}
}()
func TestMsgBinMailNotifyParseReturnsError(t *testing.T) {
m := MsgBinMailNotify{}
bf := byteframe.NewByteFrame()
_ = m.Parse(bf)
err := m.Parse(bf)
if err == nil {
t.Error("Parse() should return an error (not implemented)")
}
}
func TestMsgBinMailNotifyBuildLongName(t *testing.T) {

View File

@@ -102,19 +102,15 @@ func TestMsgBinMailNotify_Build(t *testing.T) {
}
}
func TestMsgBinMailNotify_Parse_Panics(t *testing.T) {
// Document that Parse() is not implemented and panics
func TestMsgBinMailNotify_Parse_ReturnsError(t *testing.T) {
// Document that Parse() is not implemented and returns an error
msg := MsgBinMailNotify{}
bf := byteframe.NewByteFrame()
defer func() {
if r := recover(); r == nil {
t.Error("Parse() did not panic, but should panic with 'implement me'")
}
}()
// This should panic
_ = msg.Parse(bf)
err := msg.Parse(bf)
if err == nil {
t.Error("Parse() should return an error (not implemented)")
}
}
func TestMsgBinMailNotify_BuildMultiple(t *testing.T) {

View File

@@ -1,6 +1,7 @@
package mhfpacket
import (
"strings"
"testing"
"erupe-ce/common/byteframe"
@@ -261,7 +262,8 @@ func TestBuildCoverage_NotImplemented(t *testing.T) {
return
}
// Build returned an error, which is expected for NOT IMPLEMENTED stubs
if err.Error() != "NOT IMPLEMENTED" {
errMsg := err.Error()
if errMsg != "NOT IMPLEMENTED" && !strings.Contains(errMsg, "not implemented") {
t.Errorf("Build() returned unexpected error: %v", err)
}
})