Skip to content

Commit effe9d3

Browse files
committed
Add fastpath when we exhausted the max number of channels
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
1 parent 27eace1 commit effe9d3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/channels.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ impl Inner {
374374
) -> Result<Channel> {
375375
debug!("create channel");
376376
self.channel_id.set_max(self.configuration.channel_max());
377+
if self.channels.len() >= self.configuration.channel_max() as usize {
378+
return Err(ErrorKind::ChannelsLimitReached.into());
379+
}
377380
let first_id = self.channel_id.next();
378381
let mut id = first_id;
379382
let mut met_first_id = false;

0 commit comments

Comments
 (0)