From b9636fe714f1517fcc4106e227f1338b6da6b8b3 Mon Sep 17 00:00:00 2001 From: neonphog Date: Tue, 8 Aug 2023 15:36:27 -0600 Subject: [PATCH] test fix --- crates/tx5/src/test.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/tx5/src/test.rs b/crates/tx5/src/test.rs index ca4c6684..cf421a08 100644 --- a/crates/tx5/src/test.rs +++ b/crates/tx5/src/test.rs @@ -327,17 +327,26 @@ async fn preflight_huge() { let cli_url2 = ep2.listen(sig_url).await.unwrap(); println!("cli_url2: {}", cli_url2); - ep1.send(cli_url2, &b"hello"[..]).await.unwrap(); + let recv_task = tokio::task::spawn(async move { + match ep_rcv1.recv().await { + Some(Ok(EpEvt::Connected { .. })) => (), + oth => panic!("unexpected: {:?}", oth), + } - match ep_rcv1.recv().await { - Some(Ok(EpEvt::Connected { .. })) => (), - oth => panic!("unexpected: {:?}", oth), - } + match ep_rcv2.recv().await { + Some(Ok(EpEvt::Connected { .. })) => (), + oth => panic!("unexpected: {:?}", oth), + } - match ep_rcv2.recv().await { - Some(Ok(EpEvt::Connected { .. })) => (), - oth => panic!("unexpected: {:?}", oth), - } + match ep_rcv2.recv().await { + Some(Ok(EpEvt::Data { .. })) => (), + oth => panic!("unexpected: {:?}", oth), + } + }); + + ep1.send(cli_url2, &b"hello"[..]).await.unwrap(); + + recv_task.await.unwrap(); assert_eq!(2, valid_count.load(std::sync::atomic::Ordering::SeqCst)); }