Skip to content

Commit

Permalink
split io test
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <igxnon@gmail.com>
  • Loading branch information
iGxnon committed Jul 27, 2024
1 parent 4cb6b43 commit 34ed251
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ async fn test_tokio_udp_works() {
loop {
let io = incoming.next().await.unwrap();
tokio::spawn(async move {
tokio::pin!(io);
let mut ticker = tokio::time::interval(Duration::from_millis(20));
let (reader, sender) = IO::split(io);
tokio::pin!(reader);
tokio::pin!(sender);
let mut ticker = tokio::time::interval(Duration::from_millis(5));
loop {
tokio::select! {
Some(data) = io.next() => {
io.feed(data).await.unwrap();
info!("last trace id: {:?}", (*io).last_trace_id());
Some(data) = reader.next() => {
sender.feed(Message::new(Reliability::Reliable, 0, data)).await.unwrap();
info!("last trace id: {:?}", reader.last_trace_id());
}
_ = ticker.tick() => {
io.flush().await.unwrap();
sender.flush().await.unwrap();
}
};
}
Expand Down

0 comments on commit 34ed251

Please sign in to comment.