Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
)
.await?;

// graceful TLS shutdown.
//
// `shutdown()` writes a close_notify alert, so it too can block on a stalled peer.
with_timeout(
stream.shutdown(),
"TLS shutdown",
Duration::from_secs(options.shutdown_timeout),
)
.await?;

let mut stdout = tokio_stdout();
let mut buf = vec![0u8; 8192];
loop {
Expand All @@ -98,16 +108,6 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
}
stdout.flush().await?;

// graceful TLS shutdown.
//
// `shutdown()` writes a close_notify alert, so it too can block on a stalled peer.
with_timeout(
stream.shutdown(),
"TLS shutdown",
Duration::from_secs(options.shutdown_timeout),
)
.await?;

Ok(())
}

Expand Down
Loading