Skip to content

Commit

Permalink
fix: protocol match bug
Browse files Browse the repository at this point in the history
  • Loading branch information
egonspace committed Aug 12, 2024
1 parent 0bc582c commit 5a5a6dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ func countMatchingProtocols(protocols []Protocol, caps []Cap) int {
n := 0
for _, cap := range caps {
for _, proto := range protocols {
if proto.Name == cap.Name && proto.Version == cap.Version {
if proto.Match == nil {
proto.Match = func(cap Cap) bool {
return proto.Name == cap.Name && proto.Version == cap.Version
}
}
if proto.Match(cap) {
n++
}
}
Expand Down

0 comments on commit 5a5a6dc

Please sign in to comment.