CancellationSupport
Transport-level cancellation primitive.
Transports that can propagate cancellation across the wire implement this interface. Core uses awaitRequestCancellable to convert the caller coroutine's cancellation into a sendCancel to the remote side, and server-side dispatchers use registerHandler / cancelHandler to tie incoming cancel signals to the currently running handler Job.
Implementations should treat sendCancel as best-effort — the transport may already be closed by the time the caller is cancelled, and callers rely on CancellationException propagating regardless.
Functions
Await response and, if the awaiting coroutine is cancelled before completion, invoke CancellationSupport.sendCancel for callId before re-throwing.
Cancel the handler previously registered under callId, if any.
Register a server-side handler Job under callId so that a later cancel signal from the remote side can cancel the correct handler.
Emit a cancellation signal for the given in-flight request to the remote endpoint.
Remove a previously registered handler. Safe to call for ids that were never registered.
Utility to bind the currently executing coroutine's Job to callId on a CancellationSupport so that an incoming remote cancel signal cancels this coroutine.