eth, les: unlock downloader peerSet if there's an error (#25546)

Unlock peerSet if there's an error in the downloader
This commit is contained in:
Justin Traglia 2022-08-19 01:02:47 -05:00 committed by GitHub
parent 32e8490615
commit 656dc8cc00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -237,6 +237,7 @@ func (ps *peerSet) Register(p *peerConnection) error {
} }
p.rates = msgrate.NewTracker(ps.rates.MeanCapacities(), ps.rates.MedianRoundTrip()) p.rates = msgrate.NewTracker(ps.rates.MeanCapacities(), ps.rates.MedianRoundTrip())
if err := ps.rates.Track(p.id, p.rates); err != nil { if err := ps.rates.Track(p.id, p.rates); err != nil {
ps.lock.Unlock()
return err return err
} }
ps.peers[p.id] = p ps.peers[p.id] = p

View File

@ -350,6 +350,7 @@ func (ps *peerSet) Register(p *peerConnection) error {
} }
p.rates = msgrate.NewTracker(ps.rates.MeanCapacities(), ps.rates.MedianRoundTrip()) p.rates = msgrate.NewTracker(ps.rates.MeanCapacities(), ps.rates.MedianRoundTrip())
if err := ps.rates.Track(p.id, p.rates); err != nil { if err := ps.rates.Track(p.id, p.rates); err != nil {
ps.lock.Unlock()
return err return err
} }
ps.peers[p.id] = p ps.peers[p.id] = p