withForceFreshDial method

Context withForceFreshDial(
  1. String reason
)

Creates a new Context with the force fresh dial option. Unlike withForceDirectDial (which only bypasses Swarm.dialPeer's existing-healthy-connection reuse when every healthy connection is relayed — it exists to force a direct dial past a relay conn), this unconditionally skips that reuse for one dial attempt regardless of the existing connection's type. For a caller that has independent, specific reason to believe a particular existing connection is broken (e.g. it just observed a fast disconnect right after adopting it) even though _isConnectionHealthy still reports it healthy — a stream-level RST that doesn't close the underlying muxed session isn't reflected there until the periodic health-probe loop catches up, which can take several probe cycles. See stephanfeb/dart_libp2p#23.

Implementation

Context withForceFreshDial(String reason) {
  return withValue(_forceFreshDialKey, reason);
}