Summary
In BasicHost.newStream and IdentifyService._NetNotifiee.connected, Identify was explicitly skipped for circuit-relay connections (conn.state.transport == 'circuit-relay').
Problem
Reference libp2p implementations (e.g. go-libp2p v0.47.0 holepuncher.go) require IdentifyWait(conn) to complete on inbound relayed connections before calling DirectConnect(remotePeer).
Because Dart skipped Identify on relayed connections:
- When a Dart peer connected to a Go gateway via relay, Identify was never executed.
- Go's
IdentifyWait never completed for the relayed connection.
- Go never learned Dart's supported protocols (such as
/libp2p/dcutr) or Dart's observed addresses.
- Go never triggered DCUtR hole punching (
DirectConnect).
In addition:
identifyWait contained a control-flow bug where alreadyIdentified / connClosed exited _connsMutex.synchronized early without setting completerToAwait, emitting false [IDENTIFY-WAIT-NO-COMPLETER] warning logs on reused connections.
_NetNotifiee.disconnected removed connections from _conns without completing pending identifyWaitCompleter instances with an error on connection drop, leaving callers hanging.
Proposed Fix
- Remove the
isRelayConn skip in BasicHost.newStream and IdentifyService._NetNotifiee.connected.
- Fix
identifyWait control flow to return cleanly when already identified or closed.
- Reject pending
identifyWaitCompleter instances with StateError on connection disconnect.
- Add deterministic Dart↔Go interop test verifying relayed Identify completion and automatic Go-initiated
/libp2p/dcutr stream creation.
Summary
In
BasicHost.newStreamandIdentifyService._NetNotifiee.connected, Identify was explicitly skipped forcircuit-relayconnections (conn.state.transport == 'circuit-relay').Problem
Reference libp2p implementations (e.g.
go-libp2pv0.47.0holepuncher.go) requireIdentifyWait(conn)to complete on inbound relayed connections before callingDirectConnect(remotePeer).Because Dart skipped Identify on relayed connections:
IdentifyWaitnever completed for the relayed connection./libp2p/dcutr) or Dart's observed addresses.DirectConnect).In addition:
identifyWaitcontained a control-flow bug wherealreadyIdentified/connClosedexited_connsMutex.synchronizedearly without settingcompleterToAwait, emitting false[IDENTIFY-WAIT-NO-COMPLETER]warning logs on reused connections._NetNotifiee.disconnectedremoved connections from_connswithout completing pendingidentifyWaitCompleterinstances with an error on connection drop, leaving callers hanging.Proposed Fix
isRelayConnskip inBasicHost.newStreamandIdentifyService._NetNotifiee.connected.identifyWaitcontrol flow to return cleanly when already identified or closed.identifyWaitCompleterinstances withStateErroron connection disconnect./libp2p/dcutrstream creation.