Commit 1cc8c3a1 authored by Steven Allen's avatar Steven Allen

fix(swarm): catch cases where we fail to resolve an address to a peer

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent f1b68880
......@@ -529,17 +529,17 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro
resolveErrC <- err
return
}
if len(raddrs) == 0 {
resolveErrC <- fmt.Errorf("non-resolvable multiaddr about %v", maddr)
return
}
// filter out addresses that still doesn't end in `ipfs/Qm...`
found := 0
for _, raddr := range raddrs {
if _, last := ma.SplitLast(raddr); last.Protocol().Code == ma.P_IPFS {
maddrC <- raddr
continue
found++
}
}
if found == 0 {
resolveErrC <- fmt.Errorf("non-resolvable multiaddr about %v", maddr)
}
}(maddr)
}
go func() {
......
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