@cryptotaxi247 / kubo / commits / b3d3b1dd3

refactor(bitswap) forwardN no longer needed

@whyrusleeping now, the pubsub channel closes after sending N blocks. we got this functionality for free from the fix. So, the forwardN wrap is no longer required! woohoo License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Nov 21, 2014 at 17:22 UTC b3d3b1dd301dfa1a745b045c11a0a13d987b5546
1 file changed +1 -2
exchange/bitswap/bitswap.go
+1 -2
@@ -16,7 +16,6 @@ import (
16 strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy"
17 peer "github.com/jbenet/go-ipfs/peer"
18 u "github.com/jbenet/go-ipfs/util"
19 - async "github.com/jbenet/go-ipfs/util/async"
19 "github.com/jbenet/go-ipfs/util/eventlog"
20 )
21
@@ -129,7 +128,7 @@ func (bs *bitswap) GetBlocks(ctx context.Context, keys []u.Key) (<-chan *blocks.
128 promise := bs.notifications.Subscribe(ctx, keys...)
129 select {
130 case bs.batchRequests <- keys:
132 - return async.ForwardN(ctx, promise, len(keys)), nil
131 + return promise, nil
132 case <-ctx.Done():
133 return nil, ctx.Err()
134 }