Add two-phase DTLS session shutdown - #67
Conversation
|
Ran the stack here: 538 passed on this head, matching your number. The close_notify drain is the same fix I have sitting uncommitted on a branch The measured gain on my hardware, fixed source port, previous session dropped
An orphan costs one swallowed ClientHello, so one OpenSSL retransmit timer. Taking this as it stands. One thing for a follow-up: the two-phase path sends
close_notify does not cover the same ground. In the RT-OCF tree I have checked If skipping them is deliberate, a line in the README beside the two-phase |
|
Agreed that close-notify and Observe cleanup are separate. I put the two-phase fix in #71.
|
Stack order: #67 → #68 → #69. This is 1 of 3 and should merge first.
Home Assistant begins integration shutdown before its blocking worker pool has necessarily drained. Closing the UDP socket at that point wakes blocked protocol work, but it also discards the established DTLS state before
close_notifycan be sent. On Samsung appliances that accept only one local client, the abandoned association can then remain in the way until the appliance expires it.This change gives callers a two-phase shutdown contract:
quiesce_for_close()stops new work and wakes the handshake, request, Observe-pacing, and refetch waiters while retaining an established DTLS transport.close()performs an orderly close-notify drain once the caller has joined its workers.abort()remains available when the transport must be torn down immediately.The lifecycle cancellation is owned by the session. A caller-provided cancellation event remains an input and is not mutated as a shutdown side effect.
This is intentionally limited to transport lifecycle. It does not change authentication, discovery, request retransmission, capability handling, or integration worker scheduling. It implements the shutdown boundary discussed in #28 so downstream integrations can stop blocking work before releasing the DTLS association.
Validation at
d33f896d84259a8ac6bcaaaad369bbfbd4c52c75: