Skip to content

Commit 8c805e2

Browse files
author
Axel Dahlberg
authored
Merge pull request #41 from SoftwareQuTech/master
Update Develop after hot-fix
2 parents 1bb7ec7 + 707517d commit 8c805e2

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[bumpversion]
2-
current_version = 3.0.3
2+
current_version = 3.0.4
33
commit = True
44
tag = False
55

66
[bumpversion:file:cqc/__init__.py]
7+
78
[bumpversion:file:README.md]
89

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ For more details refer to the [documentation](https://softwarequtech.github.io/S
66
Upcoming
77
--------
88

9+
2019-10-16 (v3.0.4)
10+
-------------------
11+
- 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.
12+
913
2019-10-08 (v3.0.3)
1014
-------------------
1115
- Fixed bug that mixes up return messages for different application IDs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CQC (3.0.3)
1+
# CQC (3.0.4)
22

33
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.
44

cqc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.3'
1+
__version__ = '3.0.4'

cqc/pythonLib.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def __init__(self, name, socket_address=None, appID=None, pend_messages=False,
243243
self._appID = appID
244244
self._appIDs[name].append(self._appID)
245245

246-
# Buffer received data
246+
# Buffer received data
247247
self.buf = None
248248

249249
# ClassicalServer
@@ -302,6 +302,7 @@ def __init__(self, name, socket_address=None, appID=None, pend_messages=False,
302302
time.sleep(self._conn_retry_time)
303303
self._s.close()
304304
if not retry_connection:
305+
self.close(release_qubits=False)
305306
raise err
306307
except Exception as err:
307308
logging.warning("App {} : Critical error when connection to CQC server: {}".format(self.name, err))
@@ -349,21 +350,27 @@ def get_appID(self):
349350

350351
def close(self, release_qubits=True):
351352
"""
352-
Closes the connection. Releases all qubits
353+
Closes the connection. Releases all qubits and remove the app ID from the used app IDs.
353354
"""
354355
if release_qubits:
355356
self.release_all_qubits()
356357
self._s.close()
357-
try:
358-
self._appIDs[self.name].remove(self._appID)
359-
except ValueError:
360-
pass # Already closed
358+
self._pop_app_id()
361359

362360
self.closeClassicalServer()
363361

364362
for name in list(self._classicalConn):
365363
self.closeClassicalChannel(name)
366364

365+
def _pop_app_id(self):
366+
"""
367+
Removes the used appID from the list.
368+
"""
369+
try:
370+
self._appIDs[self.name].remove(self._appID)
371+
except ValueError:
372+
pass # Already removed
373+
367374
def startClassicalServer(self):
368375
"""
369376
Sets up a server for the application communication, if not already set up.

0 commit comments

Comments
 (0)