MCPcopy
hub / github.com/pika/pika / _next_channel_number

Method _next_channel_number

pika/connection.py:1745–1758  ·  view source on GitHub ↗

Return the next available channel number or raise an exception. :rtype: int

(self)

Source from the content-addressed store, hash-verified

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

Calls

no outgoing calls