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

Commit

Permalink
refactor: avoid unnecessary go-routine
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Mar 6, 2020
1 parent 99fe214 commit f74c469
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/session/sessionwantsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// from the session
if len(prunePeers) > 0 {
for p := range prunePeers {
// Before removing the peer from the session, check if the peer
// sent us a HAVE for a block that we want
for c := range sws.wants {
if sws.bpm.PeerHasBlock(p, c) {
delete(prunePeers, p)
break
}
for p := range prunePeers {
// Before removing the peer from the session, check if the peer
// sent us a HAVE for a block that we want
for c := range sws.wants {
if sws.bpm.PeerHasBlock(p, c) {
delete(prunePeers, p)
break
}
}
}
if len(prunePeers) > 0 {
go func() {
for p := range prunePeers {
// Peer doesn't have anything we want, so remove it
Expand Down

0 comments on commit f74c469

Please sign in to comment.