拆分战斗服务器

This commit is contained in:
huangxiaolei
2022-12-19 22:11:55 +08:00
parent cf4804c444
commit 0dc45708d6
21 changed files with 793 additions and 349 deletions

View File

@@ -9,10 +9,9 @@ import (
"time"
"hk4e/common/config"
"hk4e/gate/mq"
"hk4e/common/mq"
"hk4e/gate/net"
"hk4e/pkg/logger"
"hk4e/protocol/cmd"
)
func Run(ctx context.Context, configFile string) error {
@@ -21,10 +20,9 @@ func Run(ctx context.Context, configFile string) error {
logger.InitLogger("gate")
logger.Warn("gate start")
netMsgInput := make(chan *cmd.NetMsg, 10000)
netMsgOutput := make(chan *cmd.NetMsg, 10000)
messageQueue := mq.NewMessageQueue(mq.GATE, "1")
connectManager := net.NewKcpConnectManager(netMsgInput, netMsgOutput)
connectManager := net.NewKcpConnectManager(messageQueue)
connectManager.Start()
go func() {
@@ -34,10 +32,6 @@ func Run(ctx context.Context, configFile string) error {
}
}()
messageQueue := mq.NewMessageQueue(netMsgInput, netMsgOutput)
messageQueue.Start()
defer messageQueue.Close()
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {