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-bitswap
Commits
70c89ffb
Commit
70c89ffb
authored
Dec 10, 2014
by
Jeromy
Committed by
Juan Batiz-Benet
Dec 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add priorities to GetBlocks requests, and add waitgroup to sendWantListTo
parent
13f98cb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
bitswap.go
bitswap.go
+6
-3
No files found.
bitswap.go
View file @
70c89ffb
...
@@ -174,10 +174,12 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.Peer) e
...
@@ -174,10 +174,12 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.Peer) e
for
_
,
wanted
:=
range
bs
.
wantlist
.
Entries
()
{
for
_
,
wanted
:=
range
bs
.
wantlist
.
Entries
()
{
message
.
AddEntry
(
wanted
.
Value
,
wanted
.
Priority
,
false
)
message
.
AddEntry
(
wanted
.
Value
,
wanted
.
Priority
,
false
)
}
}
wg
:=
sync
.
WaitGroup
{}
for
peerToQuery
:=
range
peers
{
for
peerToQuery
:=
range
peers
{
log
.
Debug
(
"sending query to: %s"
,
peerToQuery
)
log
.
Event
(
ctx
,
"PeerToQuery"
,
peerToQuery
)
log
.
Event
(
ctx
,
"PeerToQuery"
,
peerToQuery
)
wg
.
Add
(
1
)
go
func
(
p
peer
.
Peer
)
{
go
func
(
p
peer
.
Peer
)
{
defer
wg
.
Done
()
log
.
Event
(
ctx
,
"DialPeer"
,
p
)
log
.
Event
(
ctx
,
"DialPeer"
,
p
)
err
:=
bs
.
sender
.
DialPeer
(
ctx
,
p
)
err
:=
bs
.
sender
.
DialPeer
(
ctx
,
p
)
...
@@ -197,6 +199,7 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.Peer) e
...
@@ -197,6 +199,7 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.Peer) e
bs
.
ledgerset
.
MessageSent
(
p
,
message
)
bs
.
ledgerset
.
MessageSent
(
p
,
message
)
}(
peerToQuery
)
}(
peerToQuery
)
}
}
wg
.
Wait
()
return
nil
return
nil
}
}
...
@@ -305,8 +308,8 @@ func (bs *bitswap) clientWorker(parent context.Context) {
...
@@ -305,8 +308,8 @@ func (bs *bitswap) clientWorker(parent context.Context) {
log
.
Warning
(
"Received batch request for zero blocks"
)
log
.
Warning
(
"Received batch request for zero blocks"
)
continue
continue
}
}
for
_
,
k
:=
range
ks
{
for
i
,
k
:=
range
ks
{
bs
.
wantlist
.
Add
(
k
,
1
)
bs
.
wantlist
.
Add
(
k
,
len
(
ks
)
-
i
)
}
}
// NB: send want list to providers for the first peer in this list.
// NB: send want list to providers for the first peer in this list.
// the assumption is made that the providers of the first key in
// the assumption is made that the providers of the first key in
...
...
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