mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-27 01:53:19 +01:00
refactor(channelserver): remove Channels fallbacks, use Registry as sole cross-channel API
main.go always sets both Channels and Registry together, making the Channels fallback paths dead code. This removes: - Server.Channels field from the Server struct - 3 if/else fallback blocks in handlers_session.go (replaced with Registry.FindChannelForStage, SearchSessions, SearchStages) - 1 if/else fallback block in handlers_guild_ops.go (replaced with Registry.NotifyMailToCharID) - 3 method fallbacks in sys_channel_server.go (WorldcastMHF, FindSessionByCharID, DisconnectUser now delegate directly) Updates anti-patterns.md #6 to "accepted design" — Session struct is appropriate for this game server's handler pattern, and cross-channel coupling is now fully routed through the ChannelRegistry interface.
This commit is contained in:
@@ -572,7 +572,7 @@ func TestHandleMsgSysAuthTerminal(t *testing.T) {
|
||||
func TestHandleMsgSysLockGlobalSema_NoMatch(t *testing.T) {
|
||||
server := createMockServer()
|
||||
server.GlobalID = "test-server"
|
||||
server.Channels = []*Server{}
|
||||
server.Registry = NewLocalChannelRegistry([]*Server{})
|
||||
session := createMockSession(1, server)
|
||||
|
||||
pkt := &mhfpacket.MsgSysLockGlobalSema{
|
||||
@@ -602,7 +602,7 @@ func TestHandleMsgSysLockGlobalSema_WithChannel(t *testing.T) {
|
||||
GlobalID: "other-server",
|
||||
}
|
||||
channel.stages.Store("stage_user123", NewStage("stage_user123"))
|
||||
server.Channels = []*Server{channel}
|
||||
server.Registry = NewLocalChannelRegistry([]*Server{channel})
|
||||
|
||||
session := createMockSession(1, server)
|
||||
|
||||
@@ -633,7 +633,7 @@ func TestHandleMsgSysLockGlobalSema_SameServer(t *testing.T) {
|
||||
GlobalID: "test-server",
|
||||
}
|
||||
channel.stages.Store("stage_user456", NewStage("stage_user456"))
|
||||
server.Channels = []*Server{channel}
|
||||
server.Registry = NewLocalChannelRegistry([]*Server{channel})
|
||||
|
||||
session := createMockSession(1, server)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user