Skip to content
Merged
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
7 changes: 6 additions & 1 deletion sqlx-core/src/net/tls/tls_native_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::io::ReadBuf;
use crate::net::tls::util::StdSocket;
use crate::net::tls::TlsConfig;
use crate::net::Socket;
use crate::rt;
use crate::Error;

use native_tls::{HandshakeError, Identity};
Expand Down Expand Up @@ -61,7 +62,11 @@ pub async fn handshake<S: Socket>(
builder.identity(identity);
}

let connector = builder.build().map_err(Error::tls)?;
// The openssl TlsConnector synchronously loads certificates from files.
// Loading these files can block for tens of milliseconds.
let connector = rt::spawn_blocking(move || builder.build())
.await
.map_err(Error::tls)?;

let mut mid_handshake = match connector.connect(config.hostname, StdSocket::new(socket)) {
Ok(tls_stream) => return Ok(NativeTlsSocket { stream: tls_stream }),
Expand Down
Loading