mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-24 16:43:37 +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:
@@ -55,17 +55,19 @@ func createTestSession(mock network.Conn) *Session {
|
||||
// Create a production logger for testing (will output to stderr)
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
server := &Server{
|
||||
erupeConfig: &cfg.Config{
|
||||
DebugOptions: cfg.DebugOptions{
|
||||
LogOutboundMessages: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
server.Registry = NewLocalChannelRegistry([]*Server{server})
|
||||
s := &Session{
|
||||
logger: logger,
|
||||
sendPackets: make(chan packet, 20),
|
||||
cryptConn: mock,
|
||||
server: &Server{
|
||||
erupeConfig: &cfg.Config{
|
||||
DebugOptions: cfg.DebugOptions{
|
||||
LogOutboundMessages: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
server: server,
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user