Skip to content

Commit

Permalink
Modified the Channel stream reader/writer test to also cover Extended…
Browse files Browse the repository at this point in the history
…Data
  • Loading branch information
lowlevl committed Sep 21, 2023
1 parent 1182005 commit 23281dc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions russh/tests/test_data_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ async fn test_reader_and_writer() -> Result<(), anyhow::Error> {
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}

stream(addr, &data).await?;

Ok(())
}

async fn stream(addr: SocketAddr, data: &[u8]) -> Result<(), anyhow::Error> {
let config = Arc::new(client::Config::default());
let key = Arc::new(russh_keys::key::KeyPair::generate_ed25519().unwrap());

Expand All @@ -39,7 +45,7 @@ async fn test_reader_and_writer() -> Result<(), anyhow::Error> {
};

let mut buf = Vec::<u8>::new();
let (mut writer, mut reader) = (channel.make_writer(), channel.make_reader());
let (mut writer, mut reader) = (channel.make_writer_ext(Some(1)), channel.make_reader());

let (r0, r1) = tokio::join!(
async {
Expand Down Expand Up @@ -119,7 +125,8 @@ impl russh::server::Handler for Server {
session: Session,
) -> Result<(Self, bool, Session), Self::Error> {
tokio::spawn(async move {
let (mut writer, mut reader) = (channel.make_writer(), channel.make_reader());
let (mut writer, mut reader) =
(channel.make_writer(), channel.make_reader_ext(Some(1)));

tokio::io::copy(&mut reader, &mut writer)
.await
Expand Down

0 comments on commit 23281dc

Please sign in to comment.