Skip to content

Commit

Permalink
address the nullable-var warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gbirchmeier committed Feb 14, 2024
1 parent 3eb4ae2 commit c4ddb10
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions QuickFIXn/SocketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SocketReader : IDisposable
private readonly Parser _parser = new();
private Session? _qfSession;
private readonly Stream _stream;
private CancellationTokenSource? _readCancellationTokenSource;
private readonly CancellationTokenSource _readCancellationTokenSource;
private readonly TcpClient _tcpClient;
private readonly ClientHandlerThread _responder;
private readonly AcceptorSocketDescriptor? _acceptorDescriptor;
Expand Down Expand Up @@ -202,14 +202,12 @@ protected void ProcessStream()

protected void DisconnectClient()
{
_readCancellationTokenSource?.Cancel();
_readCancellationTokenSource?.Dispose();
_readCancellationTokenSource = null;
_readCancellationTokenSource.Cancel();
_readCancellationTokenSource.Dispose();

// just wait when read task will be cancelled
_currentReadTask?.ContinueWith(_ => { }).Wait(1000);
_currentReadTask?.Dispose();
_currentReadTask = null;

_stream.Close();
_tcpClient.Close();
Expand Down

0 comments on commit c4ddb10

Please sign in to comment.