Add Tunnel::new_with_ipr, re-export IpPair/Recipient, tidy examples
- Add Tunnel::new_with_ipr() for targeting a specific exit node - Re-export IpPair and Recipient so users don't need direct deps - Add DNS leak warning to WebSocket example - Await hyper connection task in HTTPS example
This commit is contained in:
@@ -59,7 +59,7 @@ async fn main() -> Result<(), BoxError> {
|
||||
|
||||
// Hand the TLS stream to hyper for proper HTTP/1.1 handling.
|
||||
let (mut sender, conn) = hyper::client::conn::http1::handshake(TokioIo::new(tls)).await?;
|
||||
tokio::spawn(conn);
|
||||
let conn_handle = tokio::spawn(conn);
|
||||
|
||||
let req = Request::get(path)
|
||||
.header("Host", host)
|
||||
@@ -94,6 +94,10 @@ async fn main() -> Result<(), BoxError> {
|
||||
let slowdown = mixnet_duration.as_millis() as f64 / clearnet_duration.as_millis().max(1) as f64;
|
||||
info!(" Slowdown: {slowdown:.1}x");
|
||||
|
||||
// Drop the sender so hyper knows we're done, then wait for the connection task.
|
||||
drop(sender);
|
||||
let _ = conn_handle.await;
|
||||
|
||||
tunnel.shutdown().await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user