Skip to content

Commit 9c60662

Browse files
committed
Merge pull request #554 from mousetraps/i548
#548 Debugger retry logic continues attempting to connect even though…
2 parents 29249b5 + 7d4a350 commit 9c60662

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Nodejs/Product/Nodejs/Debugger/Communication/DebuggerConnection.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ sealed class DebuggerConnection : IDebuggerConnection {
3636
private readonly INetworkClientFactory _networkClientFactory;
3737
private INetworkClient _networkClient;
3838
private readonly object _networkClientLock = new object();
39-
private volatile Version _nodeVersion;
39+
private volatile Version _nodeVersion;
40+
private bool _isClosed = false;
4041

4142
public DebuggerConnection(INetworkClientFactory networkClientFactory) {
4243
Utilities.ArgumentNotNull("networkClientFactory", networkClientFactory);
@@ -51,8 +52,10 @@ public void Dispose() {
5152
/// <summary>
5253
/// Close connection.
5354
/// </summary>
54-
public void Close() {
55-
lock (_networkClientLock) {
55+
public void Close() {
56+
_isClosed = true;
57+
58+
lock (_networkClientLock) {
5659
if (_networkClient != null) {
5760
_networkClient.Dispose();
5861
_networkClient = null;
@@ -119,7 +122,7 @@ public void Connect(Uri uri) {
119122
lock (_networkClientLock) {
120123
int connection_attempts = 0;
121124
const int MAX_ATTEMPTS = 5;
122-
while (true) {
125+
while (!_isClosed) {
123126
connection_attempts++;
124127
try {
125128
// TODO: This currently results in a call to the synchronous TcpClient

0 commit comments

Comments
 (0)