flush

open suspend fun flush(timeout: Duration): FlushOutcome

Wait, up to timeout, until a close of this link goes out behind every frame whose send returned before this call, so it cannot be what throws one away on this device.

The link-level half of us.tractat.kuilt.core.Seam.flush, with the same outcomes. The default is FlushOutcome.Unsupported: this interface cannot know what a returning send means on a transport nobody described to it. It may mean written, or queued in a library that a close then discards, and a seam over this link passes the answer up rather than claim a drain.

What to return:

This may run while another coroutine is inside send, because the seam's writer moves on to the next frame once it passes the barrier. A sink or stream that is not thread-safe must not be touched from here.

A pending flush must end when the link closes; close is how a caller gets out of a stall. The only CancellationException allowed out is the caller's own — see us.tractat.kuilt.core.Seam.close. us.tractat.kuilt.core.flushWithin handles both that and the timeout.