Avoid unneccessary multiaddr resolutions

This commit is contained in:
Lars Gierth 2017-08-06 19:19:00 +02:00
parent 0c23c9684c
commit e0c5c22dbc
1 changed files with 3 additions and 0 deletions

View File

@ -452,6 +452,9 @@ func (h *BasicHost) resolveAddrs(ctx context.Context, pi pstore.PeerInfo) ([]ma.
var addrs []ma.Multiaddr
for _, addr := range pi.Addrs {
addrs = append(addrs, addr)
if !madns.Matches(addr) {
continue
}
reqaddr := addr.Encapsulate(p2paddr)
resaddrs, err := h.maResolver.Resolve(ctx, reqaddr)