Skip to content

Commit

Permalink
fix: 修改 ShowServersInfo 函数可见性,修复服务器地址打印的指针问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Dec 26, 2023
1 parent b39625c commit 26aa2d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/multiple.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (slf *MultipleServer) Run() {
kcp.SystemTimedSched.Close()
}

ShowServersInfo(serverMultipleMark, slf.servers...)
showServersInfo(serverMultipleMark, slf.servers...)

systemSignal := make(chan os.Signal, 1)
signal.Notify(systemSignal, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
Expand Down
7 changes: 4 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (srv *Server) Run(addr string) (err error) {
onServicesInit(srv)
onMessageSystemInit(srv)
if srv.multiple == nil {
ShowServersInfo(serverMark, srv)
showServersInfo(serverMark, srv)
}
if err = <-startState; err != nil {
return err
Expand Down Expand Up @@ -780,11 +780,12 @@ func (srv *Server) HasMessageStatistics() bool {
return srv.runtime.messageStatisticsLock != nil
}

// ShowServersInfo 显示服务器信息
func ShowServersInfo(mark string, servers ...*Server) {
// showServersInfo 显示服务器信息
func showServersInfo(mark string, servers ...*Server) {
var serverInfos = make([]func(), 0, len(servers))
var ip, _ = network.IP()
for _, srv := range servers {
srv := srv
serverInfos = append(serverInfos, func() {
log.Info("Server", log.String(mark, "RunningInfo"), log.Any("network", srv.network), log.String("ip", ip.String()), log.String("listen", srv.addr))
})
Expand Down

0 comments on commit 26aa2d9

Please sign in to comment.