From ce86475eb985426e2f784ad054b4d7c17bb75f6b Mon Sep 17 00:00:00 2001 From: liuxiaobo <1224730913@qq.com> Date: Thu, 29 May 2025 23:02:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config/loadConfig.go | 2 +- server/chat/config/config.go | 2 +- server/gate/config/config.go | 6 +++--- server/login/config/config.go | 2 +- test/client/server/service.go | 7 ++++++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/config/loadConfig.go b/common/config/loadConfig.go index 2977f62..14d7da0 100644 --- a/common/config/loadConfig.go +++ b/common/config/loadConfig.go @@ -151,7 +151,7 @@ func ParseCommand() *Command { flag.StringVar(&Cmd.RedisPort, "redis_port", "6379", "redis port") flag.StringVar(&Cmd.RedisPassword, "redis_password", "fox379@@zyxi", "redis password") flag.IntVar(&Cmd.ServiceId, "sid", 0, "service id") - flag.IntVar(&Cmd.ServiceNum, "num", 0, "service num") + flag.IntVar(&Cmd.ServiceNum, "num", 1, "service num") flag.StringVar(&Cmd.VMod, "v_mod", "dev", "dev|release|test|prod") flag.Parse() return &Cmd diff --git a/server/chat/config/config.go b/server/chat/config/config.go index 989f7d2..901ad26 100644 --- a/server/chat/config/config.go +++ b/server/chat/config/config.go @@ -13,7 +13,7 @@ type ChatConfig struct { } func initLog() { - log.Open("chat/chat.log", log.DebugL) + log.Open("./log/chat.log", log.DebugL) } func LoadConfig(GitCommit, GitBranch, BuildDate string) { diff --git a/server/gate/config/config.go b/server/gate/config/config.go index 94e469f..69a3e25 100644 --- a/server/gate/config/config.go +++ b/server/gate/config/config.go @@ -10,8 +10,8 @@ import ( const ( gateKey = "gate_config" - gateAddress1 = "114.132.124.145:5100" - gateAddress2 = "114.132.124.145:5101" + gateAddress1 = "0.0.0.0:5100" + gateAddress2 = "0.0.0.0:5101" ) var Command *config.Command @@ -22,7 +22,7 @@ type GateConfig struct { } func initLog() { - log.Open("gate/gate.log", log.DebugL) + log.Open("./log/gate.log", log.DebugL) } func LoadConfig(GitCommit, GitBranch, BuildDate string) { diff --git a/server/login/config/config.go b/server/login/config/config.go index 5054c93..cc3650b 100644 --- a/server/login/config/config.go +++ b/server/login/config/config.go @@ -13,7 +13,7 @@ type LoginConfig struct { } func initLog() { - log.Open("login/login.log", log.DebugL) + log.Open("./log/login.log", log.DebugL) } func LoadConfig(GitCommit, GitBranch, BuildDate string) { diff --git a/test/client/server/service.go b/test/client/server/service.go index 58b82fc..185faaf 100644 --- a/test/client/server/service.go +++ b/test/client/server/service.go @@ -8,6 +8,7 @@ import ( "github.com/fox/fox/processor" "github.com/fox/fox/ws" "github.com/golang/protobuf/proto" + "time" ) var Clients []*ClientService @@ -44,7 +45,9 @@ func newClientService(serviceId int) *ClientService { s.password = "123456" size := len(config.Cfg.Special.Address) addr := config.Cfg.Special.Address[serviceId%size] - if s.client, err = ws.NewClient(fmt.Sprintf("ws://%v", addr), s); err != nil { + wsAddr := fmt.Sprintf("ws://%v", addr) + if s.client, err = ws.NewClient(wsAddr, s); err != nil { + log.Fatal(err.Error()) return nil } s.processor = processor.NewProcessor() @@ -56,6 +59,8 @@ func newClientService(serviceId int) *ClientService { func (s *ClientService) OnInit() { s.client.Start() log.Debug("onInit") + time.Sleep(100 * time.Millisecond) + s.login() } func (s *ClientService) CanStop() bool {