Skip to content

connection-monitor: clean up options for v4 #3515

Description

@tabcat

After the silence-gating change in #3504, ConnectionMonitorInit (packages/libp2p/src/connection-monitor.ts) has overlapping and leaky options. Two breaking cleanups for the next major (v4):

  • Drop abortConnectionOnPingFailure. Now that aborts are gated on connectionStaleTimeout, the boolean overlaps with the timeout — "never abort on ping failure" can be expressed as connectionStaleTimeout: Infinity instead of a separate flag.

  • Tidy pingTimeout (keep the adaptive timeout). Today it's Omit<AdaptiveTimeoutInit, 'metricsName' | 'metrics'>, which couples the public API to a @libp2p/utils-internal type — and the Omit key is typo'd (the field is metricName), so metricName leaks through. Replace it with connection-monitor's own { minTimeout?, maxTimeout? }, keeping AdaptiveTimeout internally so the ping timeout still adapts to RTT.

Plan to deprecate both in 3.x (@deprecated pointing here) for a runway. Behavior is unchanged — purely an options/API cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions