Commit a50a3497 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Jeromy

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: default avatarBrian Tiger Chow <brian@perfmode.com>
parent abdf5c87
...@@ -16,7 +16,6 @@ import ( ...@@ -16,7 +16,6 @@ import (
strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy" strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
async "github.com/jbenet/go-ipfs/util/async"
"github.com/jbenet/go-ipfs/util/eventlog" "github.com/jbenet/go-ipfs/util/eventlog"
) )
...@@ -129,7 +128,7 @@ func (bs *bitswap) GetBlocks(ctx context.Context, keys []u.Key) (<-chan *blocks. ...@@ -129,7 +128,7 @@ func (bs *bitswap) GetBlocks(ctx context.Context, keys []u.Key) (<-chan *blocks.
promise := bs.notifications.Subscribe(ctx, keys...) promise := bs.notifications.Subscribe(ctx, keys...)
select { select {
case bs.batchRequests <- keys: case bs.batchRequests <- keys:
return async.ForwardN(ctx, promise, len(keys)), nil return promise, nil
case <-ctx.Done(): case <-ctx.Done():
return nil, ctx.Err() return nil, ctx.Err()
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment