Unverified Commit 5c4f6571 authored by Hannah Howard's avatar Hannah Howard Committed by GitHub

fix(peerresponsemanager): avoid race condition that could result in NPE in link tracker (#118)

parent 1c792483
...@@ -349,7 +349,14 @@ func (prs *peerResponseSender) finishTracking(requestID graphsync.RequestID) boo ...@@ -349,7 +349,14 @@ func (prs *peerResponseSender) finishTracking(requestID graphsync.RequestID) boo
key, ok := prs.dedupKeys[requestID] key, ok := prs.dedupKeys[requestID]
if ok { if ok {
delete(prs.dedupKeys, requestID) delete(prs.dedupKeys, requestID)
if linkTracker.Empty() { var otherRequestsFound bool
for _, otherKey := range prs.dedupKeys {
if otherKey == key {
otherRequestsFound = true
break
}
}
if !otherRequestsFound {
delete(prs.altTrackers, key) delete(prs.altTrackers, key)
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment