proper fix for awc test

This commit is contained in:
fakeshadow 2021-01-19 03:41:29 +08:00
parent 5f22efffc4
commit 0bdbec6f25
1 changed files with 1 additions and 5 deletions

View File

@ -722,11 +722,9 @@ async fn test_client_cookie_handling() {
async fn client_unread_response() { async fn client_unread_response() {
let addr = test::unused_addr(); let addr = test::unused_addr();
let (tx, rx) = std::sync::mpsc::sync_channel(1); let lst = std::net::TcpListener::bind(addr).unwrap();
std::thread::spawn(move || { std::thread::spawn(move || {
let lst = std::net::TcpListener::bind(addr).unwrap();
tx.send(()).unwrap();
for stream in lst.incoming() { for stream in lst.incoming() {
let mut stream = stream.unwrap(); let mut stream = stream.unwrap();
let mut b = [0; 1000]; let mut b = [0; 1000];
@ -740,8 +738,6 @@ async fn client_unread_response() {
} }
}); });
rx.recv().unwrap();
// client request // client request
let req = awc::Client::new().get(format!("http://{}/", addr).as_str()); let req = awc::Client::new().get(format!("http://{}/", addr).as_str());
let mut res = req.send().await.unwrap(); let mut res = req.send().await.unwrap();