Commit e5139852 authored by Jeromy's avatar Jeromy Committed by Jeromy Johnson
Browse files

host: pre-seed preferred protocols with info from identify

parent 7a3394b1
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment