Skip to content

Commit

Permalink
changing the check for disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
huwmjenkins committed Aug 5, 2024
1 parent 46750c0 commit bc458cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions QuickFIXn/SocketInitiatorThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,10 @@ public bool Send(string data)

public void Disconnect()
{
if (_isDisconnectRequested) return;
_isDisconnectRequested = true;
if (_readCancellationTokenSource.IsCancellationRequested)
{
_readCancellationTokenSource.Cancel();
_readCancellationTokenSource.Dispose();
}
_readCancellationTokenSource.Cancel();
_readCancellationTokenSource.Dispose();

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

0 comments on commit bc458cd

Please sign in to comment.