Files
Erupe/server/channelserver/handlers_users.go
Houmgaor 99e544e0cf perf(channelserver): move UserBinary and minidata to memory-only
UserBinary type1-5 and EnhancedMinidata are transient session state
resent by the client on every login. Persisting them to the DB on
every set was unnecessary I/O. Both are now served exclusively from
server-scoped in-memory maps (userBinaryParts, minidataParts).

Includes a schema migration to drop the now-unused type2/type3
columns from user_binary and minidata column from characters.

Ref #158
2026-02-19 00:05:20 +01:00

43 lines
1.2 KiB
Go

package channelserver
import (
"erupe-ce/network/mhfpacket"
"go.uber.org/zap"
)
func handleMsgSysInsertUser(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysDeleteUser(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysSetUserBinary)
if pkt.BinaryType < 1 || pkt.BinaryType > 5 {
s.logger.Warn("Invalid BinaryType", zap.Uint8("type", pkt.BinaryType))
return
}
s.server.userBinaryPartsLock.Lock()
s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload
s.server.userBinaryPartsLock.Unlock()
s.server.BroadcastMHF(&mhfpacket.MsgSysNotifyUserBinary{
CharID: s.charID,
BinaryType: pkt.BinaryType,
}, s)
}
func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysGetUserBinary)
s.server.userBinaryPartsLock.RLock()
data, ok := s.server.userBinaryParts[userBinaryPartID{charID: pkt.CharID, index: pkt.BinaryType}]
s.server.userBinaryPartsLock.RUnlock()
if !ok {
doAckBufFail(s, pkt.AckHandle, make([]byte, 4))
} else {
doAckBufSucceed(s, pkt.AckHandle, data)
}
}
func handleMsgSysNotifyUserBinary(s *Session, p mhfpacket.MHFPacket) {}