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

Commit

Permalink
fix(sessionpeermanager): remove waitGroup
Browse files Browse the repository at this point in the history
Remove sync.waitGroup in SessionPeerManager till it's needed
  • Loading branch information
hannahhoward committed Jan 11, 2019
1 parent 3ab747f commit ce2e171
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions sessionpeermanager/sessionpeermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"math/rand"
"sync"

logging "github.com/ipfs/go-log"

Expand Down Expand Up @@ -107,19 +106,15 @@ func (spm *SessionPeerManager) FindMorePeers(ctx context.Context, c cid.Cid) {
// - manage timeouts
// - ensure two 'findprovs' calls for the same block don't run concurrently
// - share peers between sessions based on interest set
wg := &sync.WaitGroup{}
for p := range spm.network.FindProvidersAsync(ctx, k, 10) {
wg.Add(1)
go func(p peer.ID) {
defer wg.Done()
err := spm.network.ConnectTo(ctx, p)
if err != nil {
log.Debugf("failed to connect to provider %s: %s", p, err)
}
spm.peerMessages <- &peerFoundMessage{p}
}(p)
}
wg.Wait()
}(c)
}

Expand Down

0 comments on commit ce2e171

Please sign in to comment.