internal/warpc: Fix SIGSEGV in Close() when dispatcher fails to start

Only set started=true when Start() succeeds, so Close() doesn't
attempt to close a nil dispatcher.

Fixes #14536
This commit is contained in:
Bjørn Erik Pedersen
2026-03-07 11:39:31 +01:00
parent 54c804876a
commit c9b88e4d15
+4 -2
View File
@@ -776,8 +776,10 @@ func (d *lazyDispatcher[Q, R]) start() (Dispatcher[Q, R], error) {
d.startOnce.Do(func() {
start := time.Now()
d.dispatcher, d.startErr = Start[Q, R](d.opts)
d.started = true
d.opts.Infof("started dispatcher in %s", time.Since(start))
if d.startErr == nil {
d.started = true
d.opts.Infof("started dispatcher in %s", time.Since(start))
}
})
return d.dispatcher, d.startErr
}