Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #508 from ipfs/fix/disconnect-data-race
Browse files Browse the repository at this point in the history
fix(decision): fix a datarace on disconnect
  • Loading branch information
Stebalien authored Jun 24, 2021
2 parents b35e9ce + 4ffb5e9 commit 5f2fd63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/decision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,11 @@ func (e *Engine) PeerDisconnected(p peer.ID) {

ledger, ok := e.ledgerMap[p]
if ok {
for _, entry := range ledger.Entries() {
ledger.lk.RLock()
entries := ledger.Entries()
ledger.lk.RUnlock()

for _, entry := range entries {
e.peerLedger.CancelWant(p, entry.Cid)
}
}
Expand Down

0 comments on commit 5f2fd63

Please sign in to comment.