diff options
-rw-r--r-- | amqp/connection.py | 1 | ||||
-rw-r--r-- | t/unit/test_connection.py | 1 |
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)) |