mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
clean peerset constructor names
This commit is contained in:
parent
8100582e38
commit
9328fbaf81
@ -212,7 +212,7 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context, wantlist *wantli
|
||||
message.AddEntry(e.Key, e.Priority)
|
||||
}
|
||||
|
||||
ps := pset.NewPeerSet()
|
||||
ps := pset.New()
|
||||
|
||||
// Get providers for all entries in wantlist (could take a while)
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
@ -141,7 +141,7 @@ func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key u.Key, count int
|
||||
func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key u.Key, count int, peerOut chan peer.Peer) {
|
||||
defer close(peerOut)
|
||||
|
||||
ps := pset.NewLimitedPeerSet(count)
|
||||
ps := pset.NewLimited(count)
|
||||
provs := dht.providers.GetProviders(ctx, key)
|
||||
for _, p := range provs {
|
||||
// NOTE: assuming that this list of peers is unique
|
||||
|
||||
@ -12,14 +12,14 @@ type PeerSet struct {
|
||||
size int
|
||||
}
|
||||
|
||||
func NewPeerSet() *PeerSet {
|
||||
func New() *PeerSet {
|
||||
ps := new(PeerSet)
|
||||
ps.ps = make(map[string]bool)
|
||||
ps.size = -1
|
||||
return ps
|
||||
}
|
||||
|
||||
func NewLimitedPeerSet(size int) *PeerSet {
|
||||
func NewLimited(size int) *PeerSet {
|
||||
ps := new(PeerSet)
|
||||
ps.ps = make(map[string]bool)
|
||||
ps.size = size
|
||||
|
||||
Loading…
Reference in New Issue
Block a user