changes for the new interface

This commit is contained in:
Aarsh Shah
2020-05-11 13:07:08 +05:30
parent 7a58f873f4
commit dd0775df6d
5 changed files with 18 additions and 16 deletions

View File

@@ -164,9 +164,9 @@ func (pb *memoryProtoBook) SupportsProtocols(p peer.ID, protos ...string) ([]str
return out, nil
}
func (pb *memoryProtoBook) SupportsAnyProtocol(p peer.ID, protos ...string) (bool, error) {
func (pb *memoryProtoBook) FirstSupportedProtocol(p peer.ID, protos ...string) (string, error) {
if err := p.Validate(); err != nil {
return false, err
return "", err
}
s := pb.segments.get(p)
@@ -175,8 +175,8 @@ func (pb *memoryProtoBook) SupportsAnyProtocol(p peer.ID, protos ...string) (boo
for _, proto := range protos {
if _, ok := s.protocols[p][proto]; ok {
return true, nil
return proto, nil
}
}
return false, nil
return "", nil
}