summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Brown <paul90brown@gmail.com>2021-12-19 13:31:44 -0600
committerAsif Saif Uddin <auvipy@gmail.com>2021-12-20 10:35:45 +0600
commit6433be13199938f47bbc2826e6585e746baf4f9b (patch)
tree116eb27e8b04e92e8414e09497bfe7db828794c4
parent3a04bfba22334500c6a0a66ea1d3ff9ae0fcb64f (diff)
downloadpy-amqp-6433be13199938f47bbc2826e6585e746baf4f9b.tar.gz
append to _used_channel_ids in _used_channel_ids
-rw-r--r--amqp/connection.py1
-rw-r--r--t/unit/test_connection.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/amqp/connection.py b/amqp/connection.py
index 3e9097f..1dd52c1 100644
--- a/amqp/connection.py
+++ b/amqp/connection.py
@@ -484,6 +484,7 @@ class Connection(AbstractChannel):
def _get_free_channel_id(self):
for channel_id in range(1, self.channel_max):
if channel_id not in self._used_channel_ids:
+ self._used_channel_ids.append(channel_id)
return channel_id
raise ResourceError(
diff --git a/t/unit/test_connection.py b/t/unit/test_connection.py
index 03f0258..dfa9a74 100644
--- a/t/unit/test_connection.py
+++ b/t/unit/test_connection.py
@@ -350,6 +350,7 @@ class test_Connection:
def test_get_free_channel_id(self):
assert self.conn._get_free_channel_id() == 1
+ assert self.conn._get_free_channel_id() == 2
def test_get_free_channel_id__raises_IndexError(self):
self.conn._used_channel_ids = array('H', range(1, self.conn.channel_max))