diff --git a/qSharp/src/QBasicConnection.cs b/qSharp/src/QBasicConnection.cs index 3cd3e6c..b194360 100644 --- a/qSharp/src/QBasicConnection.cs +++ b/qSharp/src/QBasicConnection.cs @@ -72,7 +72,7 @@ public QBasicConnection(String host = "localhost", int port = 0, string username /// virtual public void Open() { - if (connection == null) + if (!IsConnected()) { if (Host != null) { @@ -123,7 +123,7 @@ private void Initialize() /// virtual public void Close() { - if (connection != null) + if (IsConnected()) { connection.Close(); connection = null; @@ -144,9 +144,9 @@ virtual public void Reset() } /// - /// Check whether connection with the remote q host has been established. + /// Check whether connection with the remote q host has been established and is active. /// - /// true if connection with remote host is established, false otherwise + /// true if connection with remote host is established and is active, false otherwise public bool IsConnected() { return connection != null && connection.Connected && connection.Client.Connected