go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

swarm.DialPeer and host.Connect should fail when no direct/unlimited connection is available to the peer

Open sukunrt opened this issue 2 years ago • 0 comments

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.

sukunrt avatar Feb 21 '24 15:02 sukunrt