Skip to content

Commit

Permalink
drop blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Nov 15, 2023
1 parent d69393d commit f2f3034
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use rustls::Connection;
use rustls::ServerConfig;
use rustls::ServerConnection;
use rustls::ServerName;
use tokio::task::spawn_blocking;
use std::cell::Cell;
use std::fmt::Debug;
use std::io;
Expand Down Expand Up @@ -833,6 +834,10 @@ impl Drop for TlsStream {
stm.write_buf_fully(&write_buf);
let res = poll_fn(|cx| stm.poll_shutdown(cx)).await;
trace!("shutdown handshake {:?}", res);
spawn_blocking(move || {
// Drop the TCP stream here just in case close() blocks
drop(stm);
});
}
x @ Err(_) => {
trace!("{x:?}");
Expand Down

0 comments on commit f2f3034

Please sign in to comment.