Skip to content

Commit

Permalink
Fix exception thrown from MsQuicStream writes when connection is abor…
Browse files Browse the repository at this point in the history
…ted by peer. (#67651)

* Fix exception thrown from MsQuicStream writes when connection is aborted by peer.

* Code review feedback
  • Loading branch information
rzikm authored Apr 8, 2022
1 parent 3e5e118 commit dee2bb5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,16 @@ private static uint HandleEventSendComplete(State state, ref StreamEvent evt)
}
else
{
//
// There are multiple reasons the send could have been cancelled:
// - Connection was aborted (either by transport or peer) => error-code already provided on the connection-level event
// - Stream's receive side was aborted by peer => already handled by HandleEventPeerRecvAborted
// and we will not set the exception due to complete == false
// - Stream's send side was aborted locally => no connection-level abort code and we return QuicOperationAbortException
//
state.SendResettableCompletionSource.CompleteException(
ExceptionDispatchInfo.SetCurrentStackTrace(new OperationCanceledException("Write was canceled")));
ExceptionDispatchInfo.SetCurrentStackTrace(
ThrowHelper.GetConnectionAbortedException(state.ConnectionState.AbortErrorCode)));
}
}

Expand Down

0 comments on commit dee2bb5

Please sign in to comment.