修改bug

This commit is contained in:
liuxiaobo 2025-05-29 23:02:40 +08:00
parent 29c39ad1b7
commit ce86475eb9
5 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {