nativeReturned method

void nativeReturned(
  1. C conversation,
  2. NativeTurn turn
)

Marks the boundary where the spawned streamed-send call has returned. This is the first cancellation point for a serialized policy, and the final reliable boundary when an earlier notification raced or was lost.

Implementation

void nativeReturned(C conversation, NativeTurn turn) {
  if (turn.hasEnded || !identical(_running[conversation], turn)) return;
  turn.nativeCallInFlight = false;
  turn.nativeStartPending = false;
  if (turn.cancelRequested &&
      (!turn.cancelSent || !serializeCancelWithNativeStart)) {
    turn.cancelSent = true;
    _issueCancel(conversation, turn, cancelNative);
  }
}