private uint HandleEventShutdownInitiatedByTransport(ref ConnectionEvent connectionEvent) { if (!_connected) { uint hresult = connectionEvent.Data.ShutdownInitiatedByTransport.Status; Exception ex = QuicExceptionHelpers.CreateExceptionForHResult(hresult, "Connection has been shutdown by transport."); _connectTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(ex)); } return(MsQuicStatusCodes.Success); }
private static uint HandleEventShutdownInitiatedByTransport(State state, ref ConnectionEvent connectionEvent) { if (!state.Connected) { Debug.Assert(state.Connection != null); state.Connection = null; uint hresult = connectionEvent.Data.ShutdownInitiatedByTransport.Status; Exception ex = QuicExceptionHelpers.CreateExceptionForHResult(hresult, "Connection has been shutdown by transport."); state.ConnectTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(ex)); } state.AcceptQueue.Writer.Complete(); return(MsQuicStatusCodes.Success); }
private static uint HandleEventShutdownInitiatedByTransport(State state, ref ConnectionEvent connectionEvent) { if (!state.Connected && state.ConnectTcs != null) { Debug.Assert(state.Connection != null); state.Connection = null; uint hresult = connectionEvent.Data.ShutdownInitiatedByTransport.Status; Exception ex = QuicExceptionHelpers.CreateExceptionForHResult(hresult, "Connection has been shutdown by transport."); state.ConnectTcs !.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(ex)); state.ConnectTcs = null; } // To throw QuicConnectionAbortedException (instead of QuicOperationAbortedException) out of AcceptStreamAsync() since // it wasn't our side who shutdown the connection. // We should rather keep the Status and propagate it either in a different exception or as a different field of QuicConnectionAbortedException. // See: https://github.com/dotnet/runtime/issues/60133 state.AbortErrorCode = 0; state.AcceptQueue.Writer.TryComplete(); return(MsQuicStatusCodes.Success); }