/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { ReachabilityReason } from "#protocol/ExchangeProvider.js"; import { Duration } from "@matter/general"; import type { Peer } from "./Peer.js"; /** * Monitors mDNS-discovered addresses for a peer and probes the current session when the session's IP * disappears from discovered addresses. * * When the peer's {@link IpService} reports changes, call {@link schedule} to start the debounce timer. * After stabilization, if the session's current IP is no longer in the discovered set, an empty-read * probe verifies the address is still reachable. If the current address probe fails, discovered * alternative addresses are probed in turn. If one responds, the session channel is migrated in-place * and subscriptions are re-established. If all probes fail, the session is closed so normal * reconnection takes over. * * Repeated probes for the same address use a Fibonacci-like backoff so persistent mDNS churn doesn't * flood the network. */ export declare class PeerAddressMonitor { #private; constructor(peer: Peer, stabilizationDelay: Duration, probeCooldown: { minimum: Duration; maximum: Duration; }, abort: AbortSignal, trackWork: (work: PromiseLike) => void); /** * Schedule a debounced address check. Restarts the timer on each call so rapid changes coalesce. */ schedule(): void; /** * Stop the timer. Does not cancel an in-flight probe. */ stop(): void; /** * Tear down: stop the timer and await any in-flight run so teardown does not race a probe. The * caller is expected to have aborted the peer first, so the in-flight run unwinds promptly. */ close(): Promise; /** * Verify the peer is reachable, driving recovery. Coalesces concurrent triggers into one run. * * An `address-change` run probes the current address then walks discovered alternates (migrating in * place on success); a `session-suspect` run only probes the current address and never walks alternates. * Returns `true` if the session is usable afterward (current address answered, or an alternate * answered and the session migrated); `false` if no address answered and the session was closed. */ verifyReachability(options: { reason: ReachabilityReason; abort?: AbortSignal; }): Promise; } //# sourceMappingURL=PeerAddressMonitor.d.ts.map