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
f76fe2ad
Commit
f76fe2ad
authored
Dec 23, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Dec 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(bitswap) always add addresses
parent
90324639
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
bitswap.go
bitswap.go
+2
-2
No files found.
bitswap.go
View file @
f76fe2ad
...
...
@@ -180,6 +180,7 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.PeerInf
for
peerToQuery
:=
range
peers
{
log
.
Event
(
ctx
,
"PeerToQuery"
,
peerToQuery
.
ID
)
wg
.
Add
(
1
)
bs
.
network
.
Peerstore
()
.
AddAddresses
(
peerToQuery
.
ID
,
peerToQuery
.
Addrs
)
go
func
(
p
peer
.
ID
)
{
defer
wg
.
Done
()
if
err
:=
bs
.
send
(
ctx
,
p
,
message
);
err
!=
nil
{
...
...
@@ -212,8 +213,8 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context, wantlist *wantli
defer
wg
.
Done
()
child
,
_
:=
context
.
WithTimeout
(
ctx
,
providerRequestTimeout
)
providers
:=
bs
.
routing
.
FindProvidersAsync
(
child
,
k
,
maxProvidersPerRequest
)
for
prov
:=
range
providers
{
bs
.
network
.
Peerstore
()
.
AddAddresses
(
prov
.
ID
,
prov
.
Addrs
)
if
set
.
TryAdd
(
prov
.
ID
)
{
//Do once per peer
bs
.
send
(
ctx
,
prov
.
ID
,
message
)
}
...
...
@@ -265,7 +266,6 @@ func (bs *bitswap) clientWorker(parent context.Context) {
// newer bitswap strategies.
child
,
_
:=
context
.
WithTimeout
(
ctx
,
providerRequestTimeout
)
providers
:=
bs
.
routing
.
FindProvidersAsync
(
child
,
ks
[
0
],
maxProvidersPerRequest
)
err
:=
bs
.
sendWantListTo
(
ctx
,
providers
)
if
err
!=
nil
{
log
.
Errorf
(
"error sending wantlist: %s"
,
err
)
...
...
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