Skip to content

Commit

Permalink
Protect access to s.serverClient
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmrod committed Nov 7, 2023
1 parent 458478a commit 9e0a6fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,16 @@ func (s *ExtensionManagerServer) Run() error {
for {
time.Sleep(s.pingInterval)

s.mutex.Lock()
serverClient := s.serverClient
s.mutex.Unlock()

// can't ping if s.Shutdown has already happened
if s.serverClient == nil {
if serverClient == nil {
break
}

status, err := s.serverClient.Ping()
status, err := serverClient.Ping()
if err != nil {
errc <- errors.Wrap(err, "extension ping failed")
break
Expand Down

0 comments on commit 9e0a6fd

Please sign in to comment.