Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ sealed class DebuggerConnection : IDebuggerConnection {
private readonly INetworkClientFactory _networkClientFactory;
private INetworkClient _networkClient;
private readonly object _networkClientLock = new object();
private volatile Version _nodeVersion;
private volatile Version _nodeVersion;
private bool _isClosed = false;

public DebuggerConnection(INetworkClientFactory networkClientFactory) {
Utilities.ArgumentNotNull("networkClientFactory", networkClientFactory);
Expand All @@ -51,8 +52,10 @@ public void Dispose() {
/// <summary>
/// Close connection.
/// </summary>
public void Close() {
lock (_networkClientLock) {
public void Close() {
_isClosed = true;

lock (_networkClientLock) {
if (_networkClient != null) {
_networkClient.Dispose();
_networkClient = null;
Expand Down Expand Up @@ -119,7 +122,7 @@ public void Connect(Uri uri) {
lock (_networkClientLock) {
int connection_attempts = 0;
const int MAX_ATTEMPTS = 5;
while (true) {
while (!_isClosed) {
connection_attempts++;
try {
// TODO: This currently results in a call to the synchronous TcpClient
Expand Down