Skip to content

Commit

Permalink
Initialize variable and check for nil before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Oct 26, 2024
1 parent 82cc164 commit fca7527
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ func (s *Server) Run() *gerr.GatewayDError {
return gerr.ErrCastFailed.Wrap(origErr)
}

s.isTLSEnabled = &atomic.Bool{}

go func(server *Server) {
<-server.stopServer
server.OnShutdown()
Expand Down Expand Up @@ -775,6 +777,9 @@ func (s *Server) CountConnections() int {

// IsTLSEnabled returns true if TLS is enabled.
func (s *Server) IsTLSEnabled() bool {
if s.isTLSEnabled == nil {
return false
}
return s.isTLSEnabled.Load()
}

Expand Down

0 comments on commit fca7527

Please sign in to comment.