Skip to content

Commit

Permalink
Add the 'writable_packet_size' to ChannelTx
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlevl committed Sep 21, 2023
1 parent e75de5d commit 9600bcb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions russh/src/channels/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ impl<S: From<(ChannelId, ChannelMsg)> + Send + 'static> Channel<S> {
)
}

/// Returns the min between the maximum packet size and the
/// remaining window size in the channel.
pub async fn writable_packet_size(&self) -> usize {
self.max_packet_size.min(*self.window_size.lock().await) as usize
}

pub fn id(&self) -> ChannelId {
self.id
}
Expand Down

0 comments on commit 9600bcb

Please sign in to comment.