mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-06 13:11:17 +00:00
p2p/enode: close sources added after FairMix shutdown (#35298)
`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:
parent
e3b6d0c86f
commit
415fe376a3
1 changed files with 1 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue