Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-blockservice
Commits
725e2d33
Commit
725e2d33
authored
Nov 21, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a little more correctness on the new bitswap impl
parent
acd2765e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
blockservice.go
blockservice.go
+3
-1
No files found.
blockservice.go
View file @
725e2d33
...
@@ -98,7 +98,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
...
@@ -98,7 +98,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
// GetBlocks gets a list of blocks asynchronously and returns through
// GetBlocks gets a list of blocks asynchronously and returns through
// the returned channel.
// the returned channel.
// NB: No guarantees are made about order.
// NB: No guarantees are made about order.
func
(
s
*
BlockService
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
u
.
Key
)
<-
chan
*
blocks
.
Block
{
func
(
s
*
BlockService
)
GetBlocks
(
parent
context
.
Context
,
ks
[]
u
.
Key
)
<-
chan
*
blocks
.
Block
{
out
:=
make
(
chan
*
blocks
.
Block
,
32
)
out
:=
make
(
chan
*
blocks
.
Block
,
32
)
go
func
()
{
go
func
()
{
var
toFetch
[]
u
.
Key
var
toFetch
[]
u
.
Key
...
@@ -112,11 +112,13 @@ func (s *BlockService) GetBlocks(ctx context.Context, ks []u.Key) <-chan *blocks
...
@@ -112,11 +112,13 @@ func (s *BlockService) GetBlocks(ctx context.Context, ks []u.Key) <-chan *blocks
out
<-
block
out
<-
block
}
}
ctx
,
cancel
:=
context
.
WithCancel
(
parent
)
nblocks
,
err
:=
s
.
Remote
.
GetBlocks
(
ctx
,
toFetch
)
nblocks
,
err
:=
s
.
Remote
.
GetBlocks
(
ctx
,
toFetch
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"Error with GetBlocks: %s"
,
err
)
log
.
Errorf
(
"Error with GetBlocks: %s"
,
err
)
return
return
}
}
for
blk
:=
range
nblocks
{
for
blk
:=
range
nblocks
{
out
<-
blk
out
<-
blk
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment