GPSP: Apply lint suggestions

This commit is contained in:
Palapeli 2026-04-06 07:07:13 -04:00
parent a700af444e
commit 5dee992b47
No known key found for this signature in database
GPG Key ID: 1FFE8F556A474925
2 changed files with 16 additions and 9 deletions

View File

@ -6,11 +6,15 @@ import (
"wwfc/logging"
)
func replyError(moduleName string, connIndex uint64, err gpcm.GPError) {
logging.Error(moduleName, "Reply error:", err.ErrorString)
msg := err.GetMessage()
common.SendPacket(ServerName, connIndex, []byte(msg))
if err.Fatal {
common.CloseConnection(ServerName, connIndex)
func replyError(moduleName string, connIndex uint64, gpErr gpcm.GPError) {
logging.Error(moduleName, "Reply error:", gpErr.ErrorString)
err := common.SendPacket(ServerName, connIndex, []byte(gpErr.GetMessage()))
if gpErr.Fatal || err != nil {
if err != nil {
logging.Error(moduleName, "Failed to send error message:", err)
}
if err := common.CloseConnection(ServerName, connIndex); err != nil {
logging.Error(moduleName, "Failed to close connection:", err)
}
}
}

View File

@ -45,13 +45,16 @@ func HandlePacket(index uint64, data []byte) {
replyError(moduleName, index, gpcm.ErrParse)
case "ka":
common.SendPacket(ServerName, index, []byte(`\ka\\final\`))
err = common.SendPacket(ServerName, index, []byte(`\ka\\final\`))
case "otherslist":
common.SendPacket(ServerName, index, []byte(handleOthersList(command)))
err = common.SendPacket(ServerName, index, []byte(handleOthersList(command)))
case "search":
common.SendPacket(ServerName, index, []byte(handleSearch(command)))
err = common.SendPacket(ServerName, index, []byte(handleSearch(command)))
}
}
if err != nil {
logging.Error(moduleName, "Failed to send packet:", err)
}
}