Skip to content

Commit af257d1

Browse files
committed
establish conn connections on drop
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
1 parent 00cb889 commit af257d1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/wasi-http/tests/all/http_server.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async fn test(
2727
}
2828

2929
pub struct Server {
30+
conns: usize,
3031
addr: SocketAddr,
3132
worker: Option<JoinHandle<Result<()>>>,
3233
}
@@ -67,6 +68,7 @@ impl Server {
6768
})
6869
});
6970
Ok(Self {
71+
conns,
7072
worker: Some(worker),
7173
addr,
7274
})
@@ -116,8 +118,10 @@ impl Server {
116118
impl Drop for Server {
117119
fn drop(&mut self) {
118120
debug!("shutting down http1 server");
119-
// Force a connection to happen in case one hasn't happened already.
120-
let _ = TcpStream::connect(&self.addr);
121+
for _ in 0..self.conns {
122+
// Force a connection to happen in case one hasn't happened already.
123+
let _ = TcpStream::connect(&self.addr);
124+
}
121125

122126
// If the worker fails with an error, report it here but don't panic.
123127
// Some tests don't make a connection so the error will be that the tcp

0 commit comments

Comments
 (0)