Commit 9cad93a8 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Jeromy

naming

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent a82ac0a9
...@@ -43,7 +43,7 @@ func New(ctx context.Context, p peer.Peer, ...@@ -43,7 +43,7 @@ func New(ctx context.Context, p peer.Peer,
routing: routing, routing: routing,
sender: network, sender: network,
wantlist: u.NewKeySet(), wantlist: u.NewKeySet(),
blockReq: make(chan u.Key, 32), blockRequests: make(chan u.Key, 32),
} }
network.SetDelegate(bs) network.SetDelegate(bs)
go bs.run(ctx) go bs.run(ctx)
...@@ -66,7 +66,7 @@ type bitswap struct { ...@@ -66,7 +66,7 @@ type bitswap struct {
notifications notifications.PubSub notifications notifications.PubSub
blockReq chan u.Key blockRequests chan u.Key
// strategy listens to network traffic and makes decisions about how to // strategy listens to network traffic and makes decisions about how to
// interact with partners. // interact with partners.
...@@ -100,7 +100,7 @@ func (bs *bitswap) GetBlock(parent context.Context, k u.Key) (*blocks.Block, err ...@@ -100,7 +100,7 @@ func (bs *bitswap) GetBlock(parent context.Context, k u.Key) (*blocks.Block, err
promise := bs.notifications.Subscribe(ctx, k) promise := bs.notifications.Subscribe(ctx, k)
select { select {
case bs.blockReq <- k: case bs.blockRequests <- k:
case <-parent.Done(): case <-parent.Done():
return nil, parent.Err() return nil, parent.Err()
} }
...@@ -185,7 +185,7 @@ func (bs *bitswap) run(ctx context.Context) { ...@@ -185,7 +185,7 @@ func (bs *bitswap) run(ctx context.Context) {
} }
sendlist = nil sendlist = nil
timeout = time.After(rebroadcastTime) timeout = time.After(rebroadcastTime)
case k := <-bs.blockReq: case k := <-bs.blockRequests:
if unsent == 0 { if unsent == 0 {
sendlist = bs.routing.FindProvidersAsync(ctx, k, peersPerSend) sendlist = bs.routing.FindProvidersAsync(ctx, k, peersPerSend)
} }
......
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