Return the next available channel number or raise an exception. :rtype: int
(self)
| 1743 | return isinstance(value, frame.ProtocolHeader) |
| 1744 | |
| 1745 | def _next_channel_number(self) -> int: |
| 1746 | """Return the next available channel number or raise an exception. |
| 1747 | |
| 1748 | :rtype: int |
| 1749 | |
| 1750 | """ |
| 1751 | limit = self.params.channel_max or pika.channel.MAX_CHANNELS |
| 1752 | if len(self._channels) >= limit: |
| 1753 | raise exceptions.NoFreeChannels() |
| 1754 | |
| 1755 | for num in range(1, len(self._channels) + 1): |
| 1756 | if num not in self._channels: |
| 1757 | return num |
| 1758 | return len(self._channels) + 1 |
| 1759 | |
| 1760 | def _on_channel_cleanup(self, channel: Channel) -> None: |
| 1761 | """Remove the channel from the dict of channels when Channel.CloseOk is |
no outgoing calls