Commit 22f0c797 authored by Dirk McCormick's avatar Dirk McCormick Committed by Steven Allen

refactor: avoid unnecessary go-routine

parent 33443d77
...@@ -368,17 +368,17 @@ func (sws *sessionWantSender) processUpdates(updates []update) []cid.Cid { ...@@ -368,17 +368,17 @@ func (sws *sessionWantSender) processUpdates(updates []update) []cid.Cid {
// If any peers have sent us too many consecutive DONT_HAVEs, remove them // If any peers have sent us too many consecutive DONT_HAVEs, remove them
// from the session // from the session
if len(prunePeers) > 0 { for p := range prunePeers {
for p := range prunePeers { // Before removing the peer from the session, check if the peer
// Before removing the peer from the session, check if the peer // sent us a HAVE for a block that we want
// sent us a HAVE for a block that we want for c := range sws.wants {
for c := range sws.wants { if sws.bpm.PeerHasBlock(p, c) {
if sws.bpm.PeerHasBlock(p, c) { delete(prunePeers, p)
delete(prunePeers, p) break
break
}
} }
} }
}
if len(prunePeers) > 0 {
go func() { go func() {
for p := range prunePeers { for p := range prunePeers {
// Peer doesn't have anything we want, so remove it // Peer doesn't have anything we want, so remove it
......
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