Skip to content

Commit 0f72ac7

Browse files
committed
Use a property
1 parent 1393ecc commit 0f72ac7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ private void UpdateHighestOpenedRequestStreamId(long streamId)
101101
public string ConnectionId => _context.ConnectionId;
102102
public ITimeoutControl TimeoutControl => _context.TimeoutControl;
103103

104+
// The default error value is -1. If it hasn't been changed before abort is called then default to HTTP/3's NoError value.
105+
private Http3ErrorCode Http3ErrorCodeOrNoError => _errorCodeFeature.Error == -1 ? Http3ErrorCode.NoError : (Http3ErrorCode)_errorCodeFeature.Error;
106+
104107
public void StopProcessingNextRequest(ConnectionEndReason reason)
105108
=> StopProcessingNextRequest(serverInitiated: true, reason);
106109

@@ -505,7 +508,7 @@ public async Task ProcessRequestsAsync<TContext>(IHttpApplication<TContext> appl
505508
}
506509
}
507510

508-
var errorCode = GetErrorCodeOrNoError();
511+
var errorCode = Http3ErrorCodeOrNoError;
509512

510513
// Abort active request streams.
511514
lock (_streams)
@@ -907,7 +910,7 @@ public void OnInputOrOutputCompleted()
907910
TryStopAcceptingStreams();
908911

909912
// Abort the connection using the error code the client used. For a graceful close, this should be H3_NO_ERROR.
910-
Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient), GetErrorCodeOrNoError(), ConnectionEndReason.TransportCompleted);
913+
Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient), Http3ErrorCodeOrNoError, ConnectionEndReason.TransportCompleted);
911914
}
912915

913916
internal WebTransportSession OpenNewWebTransportSession(Http3Stream http3Stream)
@@ -925,12 +928,6 @@ internal WebTransportSession OpenNewWebTransportSession(Http3Stream http3Stream)
925928
return session;
926929
}
927930

928-
private Http3ErrorCode GetErrorCodeOrNoError()
929-
{
930-
// The default error value is -1. If it hasn't been changed before abort is called then default to HTTP/3's NoError value.
931-
return _errorCodeFeature.Error == -1 ? Http3ErrorCode.NoError : (Http3ErrorCode)_errorCodeFeature.Error;
932-
}
933-
934931
private static class GracefulCloseInitiator
935932
{
936933
public const int None = 0;

0 commit comments

Comments
 (0)