Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CHANNEL_ERROR/ChannelNotOpen #383

Merged
merged 1 commit into from
Dec 20, 2021
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
1 change: 1 addition & 0 deletions amqp/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ def collect(self):
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(
Expand Down
1 change: 1 addition & 0 deletions t/unit/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def test_collect_again(self):

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))
Expand Down