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/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 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' 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.