Skip to content

Commit

Permalink
fix signal handler and add debuglogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
inada-s committed May 2, 2020
1 parent cbbb765 commit 1ec5ec0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions gdxsv/lbs_lobby.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"github.com/golang/glog"
)

type LbsLobby struct {
Expand Down Expand Up @@ -227,14 +228,19 @@ func (l *LbsLobby) CheckLobbyBattleStart() {
if McsFuncEnabled() && l.McsRegion != "" {
stat := l.app.FindMcs(l.McsRegion)
if stat == nil {
glog.Info("call mcsfunc alloc:", l.McsRegion)
GoMcsFuncAlloc(l.McsRegion)
return
}

peer := l.app.FindMcsPeer(stat.PublicAddr)
if peer != nil {
mcsPeer = peer
mcsAddr = stat.PublicAddr
if peer == nil {
glog.Info("msc peer not found:", stat)
return
}

mcsPeer = peer
mcsAddr = stat.PublicAddr
}

b := NewBattle(l.app, l.ID, l.Rule, l.McsRegion, mcsAddr)
Expand Down
3 changes: 2 additions & 1 deletion gdxsv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"os/signal"
"runtime"
"syscall"
"time"

"github.com/caarlos0/env"
Expand Down Expand Up @@ -130,7 +131,7 @@ func mainLbs() {
defer mcs.Quit()

c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
if *dump {
dumper := spew.NewDefaultConfig()
dumper.MaxDepth = 7
Expand Down

0 comments on commit 1ec5ec0

Please sign in to comment.