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-dms3
Commits
ed450992
Commit
ed450992
authored
Nov 21, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracking down a bug dhthell found, added asserts and better logging.
parent
15d4f829
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
blockservice/blockservice.go
blockservice/blockservice.go
+1
-1
exchange/bitswap/bitswap.go
exchange/bitswap/bitswap.go
+11
-5
net/swarm/conn.go
net/swarm/conn.go
+1
-1
unixfs/io/dagreader.go
unixfs/io/dagreader.go
+4
-0
No files found.
blockservice/blockservice.go
View file @
ed450992
...
...
@@ -101,7 +101,6 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
func
(
s
*
BlockService
)
GetBlocks
(
ctx
context
.
Context
,
ks
[]
u
.
Key
)
<-
chan
*
blocks
.
Block
{
out
:=
make
(
chan
*
blocks
.
Block
,
32
)
go
func
()
{
defer
close
(
out
)
var
toFetch
[]
u
.
Key
for
_
,
k
:=
range
ks
{
block
,
err
:=
s
.
Blockstore
.
Get
(
k
)
...
...
@@ -121,6 +120,7 @@ func (s *BlockService) GetBlocks(ctx context.Context, ks []u.Key) <-chan *blocks
for
blk
:=
range
nblocks
{
out
<-
blk
}
close
(
out
)
}()
return
out
}
...
...
exchange/bitswap/bitswap.go
View file @
ed450992
...
...
@@ -197,13 +197,19 @@ func (bs *bitswap) loop(parent context.Context) {
}
}
case
ks
:=
<-
bs
.
batchRequests
:
// TODO: implement batching on len(ks) > X for some X
if
len
(
ks
)
==
0
{
log
.
Warning
(
"Received batch request for zero blocks"
)
continue
}
for
_
,
k
:=
range
ks
{
bs
.
wantlist
.
Add
(
k
)
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
k
,
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
}
}
providers
:=
bs
.
routing
.
FindProvidersAsync
(
ctx
,
ks
[
0
],
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
}
case
<-
parent
.
Done
()
:
return
...
...
net/swarm/conn.go
View file @
ed450992
...
...
@@ -182,7 +182,7 @@ func (s *Swarm) fanOut() {
return
}
if
len
(
msg
.
Data
())
>=
conn
.
MaxMessageSize
{
log
.
Critical
(
"Attempted to send message bigger than max size.
"
)
log
.
Critical
f
(
"Attempted to send message bigger than max size.
(%d)"
,
len
(
msg
.
Data
())
)
}
s
.
connsLock
.
RLock
()
...
...
unixfs/io/dagreader.go
View file @
ed450992
...
...
@@ -68,6 +68,7 @@ func (dr *DagReader) precalcNextBuf() error {
// TODO: this logic is hard to follow, do it better.
// NOTE: the only time this code is used, is during the
// importer tests, consider just changing those tests
log
.
Warning
(
"Running DAGReader with nil DAGService!"
)
if
dr
.
linkPosition
>=
len
(
dr
.
node
.
Links
)
{
return
io
.
EOF
}
...
...
@@ -78,6 +79,9 @@ func (dr *DagReader) precalcNextBuf() error {
dr
.
linkPosition
++
}
else
{
if
dr
.
fetchChan
==
nil
{
panic
(
"this is wrong."
)
}
select
{
case
nxt
,
ok
=
<-
dr
.
fetchChan
:
if
!
ok
{
...
...
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