go-libp2p
go-libp2p copied to clipboard
swarm.DialPeer and host.Connect should fail when no direct/unlimited connection is available to the peer
Currently there's an inconsistency between swarm.NewStream and swarm.DialPeer. swarm.NewStream returns ErrTransientConn when no unlimited connection to the peer exists. swarm.DialPeer returns the transient connection even when no network.WithUseTransient option is used.
swarm.DialPeer should wait for a direct connection when it only has a transient connection and return ErrTransientConn if it fails to get a hole punched connection, just like swarm.NewStream
host.Connect should also have the same behaviour.