// Triggered by request CancellationToken canceling or response stream Disposal. internal void ClientInitiatedAbort() { if (!_pipelineFinished) { // We don't want to trigger the token for already completed responses. _requestLifetimeFeature.Cancel(); } // Writes will still succeed, the app will only get an error if they check the CT. _responseReaderStream.Abort(new IOException("The client aborted the request.")); }
// Triggered by request CancellationToken canceling or response stream Disposal. internal void ClientInitiatedAbort() { if (!_pipelineFinished) { // We don't want to trigger the token for already completed responses. _requestLifetimeFeature.Cancel(); } // Writes will still succeed, the app will only get an error if they check the CT. _responseReaderStream.Abort(new IOException("The client aborted the request.")); // Cancel any pending request async activity when the client aborts a duplex // streaming scenario by disposing the HttpResponseMessage. CancelRequestBody(); }
internal void Abort(Exception exception) { _pipelineFinished = true; _responsePipeWriter.Abort(exception); _responseReaderStream.Abort(exception); _responseTcs.TrySetException(exception); }