Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -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]

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion cqc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.3'
__version__ = '3.0.4'
19 changes: 13 additions & 6 deletions cqc/pythonLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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.
Expand Down