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

fix(decision): fix a datarace on disconnect #508

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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