Skip to content

Commit 7620605

Browse files
authored
Merge pull request connamara#951 from gbirchmeier/session-disconnect
SocketInitiatorThread - restore Session disconnect during Read exception
2 parents 0f5c755 + 7a0f2cc commit 7620605

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

QuickFIXn/SocketInitiatorThread.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class SocketInitiatorThread : IResponder
2727
private readonly CancellationTokenSource _readCancellationTokenSource = new();
2828
private readonly IPEndPoint _socketEndPoint;
2929
private readonly SocketSettings _socketSettings;
30-
private bool _isDisconnectRequested = false;
3130

3231
/// <summary>
3332
/// Keep a task for handling async read
@@ -50,7 +49,6 @@ public SocketInitiatorThread(
5049

5150
public void Start()
5251
{
53-
_isDisconnectRequested = false;
5452
_thread = new Thread(Transport.SocketInitiator.SocketInitiatorThreadStart);
5553
_thread.Start(this);
5654
}
@@ -97,16 +95,9 @@ public bool Read()
9795
ProcessStream();
9896
return true;
9997
}
100-
catch (ObjectDisposedException)
101-
{
102-
// this exception means _socket is already closed when poll() is called
103-
if (_isDisconnectRequested == false)
104-
Disconnect();
105-
}
10698
catch (Exception e)
10799
{
108-
Session.Log.OnEvent(e.ToString());
109-
Disconnect();
100+
Session.Disconnect(e.ToString()); // also calls this instance's Disconect()
110101
}
111102
return false;
112103
}
@@ -197,7 +188,6 @@ public bool Send(string data)
197188

198189
public void Disconnect()
199190
{
200-
_isDisconnectRequested = true;
201191
_readCancellationTokenSource.Cancel();
202192
_readCancellationTokenSource.Dispose();
203193

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ What's New
4141
* #895 - fix: When SSLCACertificate is empty an error is logged and it fails to start (dckorben)
4242
* #942 - fix #942: field 369 (LastMsgSeqNumProcessed) wrong in ResendRequest message (gbirchmeier)
4343
* #940 - Create an alternate CharEncoding.GetBytes impl which uses ArrayPool to improve memory performance (VAllens)
44+
* #951 - fix: restore Session disconnect during SocketInitiatorThread.Read exception (gbirchmeier/trevor-bush)
4445

4546
### v1.13.0
4647

0 commit comments

Comments
 (0)