Skip to content

PingKit 0.6.0

Choose a tag to compare

@gewill gewill released this 14 Jul 14:36
· 17 commits to main since this release

PingKit 0.6.0 makes send failures non-fatal. A probe the socket rejects
(e.g. an IPv4 literal forced onto an IPv6-only network, or a briefly
unreachable interface) no longer aborts the whole run — it surfaces as a
.sendFailed event and the session recovers on the next interval.

This is a breaking minor: PingResponse gains a case.

New invariant

Each sequence produces exactly one of two outcomes:

  • (a) .sent followed by a terminal event (.reply, .timeout,
    .unreachable, .timeExceeded, .packetTooBig, .parameterProblem) —
    the socket accepted the probe; or
  • (b) a single .sendFailed(sequence:errno:) with no .sent — the
    probe never left the socket.

Changes

  • PingResponse.sendFailed(sequence: UInt16, errno: Int32) — new case.
  • Non-fatal send path: Pinger no longer finishes the stream on a send
    error. The failed probe isn't counted in transmitted, gets no pending
    entry and no .sent; the run continues and recovers when the network does.
    A bounded .times(n) run still terminates (the failed slot completes).
  • One-shot ping(_:) still throws PingError.sendFailed(errno:).
  • Statistics: failed sends are not counted toward transmitted.
  • CLI: prints Send failed for icmp_seq N (errno …) per failure and
    exits non-zero when nothing came back — whether probes were sent and lost
    or never left the socket at all — closer to ping(8).

Breaking change

PingResponse gains .sendFailed; exhaustive switches must handle it.

Notes

Verified on macOS, iOS Simulator, and Linux Swift 6.0 / 6.1 (72 tests).
End-to-end: pingkit-cli 8.8.8.8 -6 (IPv4 literal forced to IPv6, errno 22)
now reports a send failure per probe and runs to completion instead of
aborting.