@cryptotaxi247 / kubo / commits / 26a44fcc0

dht: comment for asyncQueryBuffer

Juan Batiz-Benet committed Dec 8, 2014 at 21:55 UTC 26a44fcc0626ee2de17e70790ec95ff1ea315bed
1 file changed +7 -1
routing/dht/routing.go
+7 -1
@@ -13,6 +13,12 @@ import (
13 u "github.com/jbenet/go-ipfs/util"
14 )
15
16 +// asyncQueryBuffer is the size of buffered channels in async queries. This
17 +// buffer allows multiple queries to execute simultaneously, return their
18 +// results and continue querying closer peers. Note that different query
19 +// results will wait for the channel to drain.
20 +var asyncQueryBuffer = 10
21 +
22 // This file implements the Routing interface for the IpfsDHT struct.
23
24 // Basic Put/Get
@@ -272,7 +278,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.Peer, error)
278 // FindPeersConnectedToPeer searches for peers directly connected to a given peer.
279 func (dht *IpfsDHT) FindPeersConnectedToPeer(ctx context.Context, id peer.ID) (<-chan peer.Peer, error) {
280
275 - peerchan := make(chan peer.Peer, 10)
281 + peerchan := make(chan peer.Peer, asyncQueryBuffer)
282 peersSeen := map[string]peer.Peer{}
283
284 routeLevel := 0