Skip to content

Commit

Permalink
fix: 修复 gnet 作为服务器核心关闭时导致的空指针问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Sep 13, 2023
1 parent dc3c7d2 commit 2712f3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ func (slf *Server) shutdown(err error) {
slf.multipleRuntimeErrorChan <- err
}
}()
if slf.gServer != nil && slf.isRunning {
if shutdownErr := gnet.Stop(context.Background(), fmt.Sprintf("%s://%s", slf.network, slf.addr)); err != nil {
log.Error("Server", log.Err(shutdownErr))
}
}
if slf.ticker != nil {
slf.ticker.Release()
}
Expand Down Expand Up @@ -503,11 +508,6 @@ func (slf *Server) shutdown(err error) {
log.Error("Server", log.Err(shutdownErr))
}
}
if slf.gServer != nil && slf.isRunning {
if shutdownErr := gnet.Stop(context.Background(), fmt.Sprintf("%s://%s", slf.network, slf.addr)); err != nil {
log.Error("Server", log.Err(shutdownErr))
}
}

if err != nil {
if slf.multiple != nil {
Expand Down

0 comments on commit 2712f3b

Please sign in to comment.