Skip to content

Commit 5601b4d

Browse files
committed
Lock around close return
1 parent 0c84636 commit 5601b4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

provisionerd/provisionerd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,13 @@ func (p *provisionerDaemon) connect(ctx context.Context) {
110110
if errors.Is(err, context.Canceled) {
111111
return
112112
}
113+
p.closeMutex.Lock()
113114
if p.isClosed() {
115+
p.closeMutex.Unlock()
114116
return
115117
}
116118
p.opts.Logger.Warn(context.Background(), "failed to dial", slog.Error(err))
119+
p.closeMutex.Unlock()
117120
continue
118121
}
119122
p.opts.Logger.Debug(context.Background(), "connected")

0 commit comments

Comments
 (0)