refac(bitswap) extract const
Brian Tiger Chow committed
Sep 18, 2014 at 19:54 UTC
74e81e06facf0d52e7beef9b7d44226d19a11dc5
1 file changed
+4
-1
exchange/bitswap/bitswap.go
+4
-1
@@ -63,9 +63,12 @@ type bitswap struct {
63
64
// GetBlock attempts to retrieve a particular block from peers within the
65
// deadline enforced by the context
66
+//
67
+// TODO ensure only one active request per key
68
func (bs *bitswap) Block(ctx context.Context, k u.Key) (*blocks.Block, error) {
69
68
- provs_ch := bs.routing.FindProvidersAsync(ctx, k, 20)
70
+ const maxProviders = 20
71
+ provs_ch := bs.routing.FindProvidersAsync(ctx, k, maxProviders)
72
73
blockChannel := make(chan blocks.Block)
74