提交 b3d3b1dd 作者: Brian Tiger Chow 提交者: 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: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 a5fccacc
......@@ -16,7 +16,6 @@ import (
strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy"
peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util"
async "github.com/jbenet/go-ipfs/util/async"
"github.com/jbenet/go-ipfs/util/eventlog"
)
......@@ -129,7 +128,7 @@ func (bs *bitswap) GetBlocks(ctx context.Context, keys []u.Key) (<-chan *blocks.
promise := bs.notifications.Subscribe(ctx, keys...)
select {
case bs.batchRequests <- keys:
return async.ForwardN(ctx, promise, len(keys)), nil
return promise, nil
case <-ctx.Done():
return nil, ctx.Err()
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论