p2p/enode: close sources added after FairMix shutdown (#35298)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

`FairMix.AddSource` takes ownership of the supplied iterator, but if the
mixer has already been closed it currently returns without closing that
iterator. Close the rejected source in this shutdown path so callers
racing with `Close` do not leak iterator resources.
This commit is contained in:
rayoo 2026-07-05 11:21:24 -07:00 committed by GitHub
parent e3b6d0c86f
commit 415fe376a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -356,6 +356,7 @@ func (m *FairMix) AddSource(it Iterator) {
defer m.mu.Unlock()
if m.closed == nil {
it.Close()
return
}
m.wg.Add(1)