File tree Expand file tree Collapse file tree
Nodejs/Product/Nodejs/Debugger/Communication Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments