Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
e5139852
Commit
e5139852
authored
Aug 16, 2016
by
Jeromy
Committed by
Jeromy Johnson
Aug 18, 2016
Browse files
host: pre-seed preferred protocols with info from identify
parent
7a3394b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/host/basic/basic_host.go
View file @
e5139852
...
...
@@ -207,7 +207,17 @@ func (h *BasicHost) preferredProtocol(p peer.ID, pids []protocol.ID) protocol.ID
prefs
,
ok
:=
h
.
protoPrefs
[
p
]
if
!
ok
{
return
""
supported
,
err
:=
h
.
Peerstore
()
.
GetProtocols
(
p
)
if
err
!=
nil
{
log
.
Warningf
(
"error getting protocol for peer %s: %s"
,
p
,
err
)
return
""
}
prefs
=
make
(
map
[
protocol
.
ID
]
struct
{})
for
_
,
proto
:=
range
supported
{
prefs
[
protocol
.
ID
(
proto
)]
=
struct
{}{}
}
h
.
protoPrefs
[
p
]
=
prefs
}
for
_
,
pid
:=
range
pids
{
...
...
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