mirror of https://github.com/fafhrd91/actix-web
Fix bug of client_unread_response test
This commit is contained in:
parent
c201c15f8c
commit
99859d8019
|
@ -722,8 +722,12 @@ 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 ready = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||||
|
let ready_clone = ready.clone();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let lst = std::net::TcpListener::bind(addr).unwrap();
|
let lst = std::net::TcpListener::bind(addr).unwrap();
|
||||||
|
ready_clone.store(true, Ordering::Relaxed);
|
||||||
|
|
||||||
for stream in lst.incoming() {
|
for stream in lst.incoming() {
|
||||||
let mut stream = stream.unwrap();
|
let mut stream = stream.unwrap();
|
||||||
|
@ -738,6 +742,9 @@ async fn client_unread_response() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// wait for server thread ready
|
||||||
|
while !ready.load(Ordering::Relaxed) {}
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
Loading…
Reference in New Issue