PingKit 0.6.0
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)
.sentfollowed 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:
Pingerno longer finishes the stream on a send
error. The failed probe isn't counted intransmitted, 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 throwsPingError.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 toping(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.