From f0e39ada75276e387904f9c2c6162eeafca76498 Mon Sep 17 00:00:00 2001 From: Axel Dahlberg Date: Wed, 16 Oct 2019 14:41:36 +0200 Subject: [PATCH 1/3] If a CQCConnection does not manage to connect to the cqc server, the used app ID is popped from the list of used ones, to be reused again --- cqc/pythonLib.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cqc/pythonLib.py b/cqc/pythonLib.py index df28c85..2216960 100644 --- a/cqc/pythonLib.py +++ b/cqc/pythonLib.py @@ -243,7 +243,7 @@ def __init__(self, name, socket_address=None, appID=None, pend_messages=False, self._appID = appID self._appIDs[name].append(self._appID) - # Buffer received data + # Buffer received data self.buf = None # ClassicalServer @@ -302,6 +302,7 @@ def __init__(self, name, socket_address=None, appID=None, pend_messages=False, time.sleep(self._conn_retry_time) self._s.close() if not retry_connection: + self.close(release_qubits=False) raise err except Exception as err: logging.warning("App {} : Critical error when connection to CQC server: {}".format(self.name, err)) @@ -349,21 +350,27 @@ def get_appID(self): def close(self, release_qubits=True): """ - Closes the connection. Releases all qubits + Closes the connection. Releases all qubits and remove the app ID from the used app IDs. """ if release_qubits: self.release_all_qubits() self._s.close() - try: - self._appIDs[self.name].remove(self._appID) - except ValueError: - pass # Already closed + self._pop_app_id() self.closeClassicalServer() for name in list(self._classicalConn): self.closeClassicalChannel(name) + def _pop_app_id(self): + """ + Removes the used appID from the list. + """ + try: + self._appIDs[self.name].remove(self._appID) + except ValueError: + pass # Already removed + def startClassicalServer(self): """ Sets up a server for the application communication, if not already set up. From 47f4952959680977b1eaf2a53f2c9f0481acf127 Mon Sep 17 00:00:00 2001 From: Axel Dahlberg Date: Wed, 16 Oct 2019 14:42:47 +0200 Subject: [PATCH 2/3] Updated CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4b74a1..9bad870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ For more details refer to the [documentation](https://softwarequtech.github.io/S Upcoming -------- +2019-10-16 (v3.0.4) +------------------- +- If a CQCConnection does not manage to connect to the cqc server, the used app ID is popped from the list of used ones, to be reused again. + 2019-10-08 (v3.0.3) ------------------- - Fixed bug that mixes up return messages for different application IDs From feadc090cc8edee0bc9c56299dc0f5e240e39ea4 Mon Sep 17 00:00:00 2001 From: Axel Dahlberg Date: Wed, 16 Oct 2019 14:42:49 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Bump=20version:=203.0.3=20=E2=86=92=203.0.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 3 ++- README.md | 2 +- cqc/__init__.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index cb38708..6d87aed 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,8 +1,9 @@ [bumpversion] -current_version = 3.0.3 +current_version = 3.0.4 commit = True tag = False [bumpversion:file:cqc/__init__.py] + [bumpversion:file:README.md] diff --git a/README.md b/README.md index 3da3bc9..059cc0a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CQC (3.0.3) +# CQC (3.0.4) The classical-quantum combiner (CQC) interface is an interface between higher layers and hardware in a Quantum Internet. It comes with a Python, C and Rust library for constructing CQC messages. The Python library is definitely the best place to get started. diff --git a/cqc/__init__.py b/cqc/__init__.py index d298347..9a8a1b1 100644 --- a/cqc/__init__.py +++ b/cqc/__init__.py @@ -1 +1 @@ -__version__ = '3.0.3' +__version__ = '3.0.4'