diff --git a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/CustomTransport/GenericServer.cs b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/CustomTransport/GenericServer.cs index 23e5fda37..11ac59cab 100644 --- a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/CustomTransport/GenericServer.cs +++ b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/CustomTransport/GenericServer.cs @@ -74,12 +74,12 @@ private async void HandleConnection(ConnectionContext connection, int transmissi // reset by client logger.ConnectionWasResetByClient(clientAddress); } - catch (OperationCanceledException) when (tokenSource is not null && tokenSource.CancellationOrigin == connection.ConnectionClosed) + catch (OperationCanceledException) when (tokenSource?.CancellationOrigin == connection.ConnectionClosed) { // closed by client logger.ConnectionWasResetByClient(clientAddress); } - catch (OperationCanceledException) when (tokenSource is not null && tokenSource.CancellationOrigin == lifecycleToken) + catch (OperationCanceledException) when (tokenSource?.CancellationOrigin == lifecycleToken) { // server stopped, suppress exception }