libp2p / libp2p/go-libp2p

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

Open
#2,714 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing swarm.NewStream with swarm.DialPeer and host.Connect, focusing on how each handles an available transient connection and the network.WithUseTransient option. Trace the hole-punching wait path and verify that DialPeer and Connect return ErrTransientConn when no direct or unlimited connection becomes available.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.