summaryrefslogtreecommitdiff
path: root/ext/net/ops_tls.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-05-01 16:42:05 -0400
committerGitHub <noreply@github.com>2023-05-01 16:42:05 -0400
commit913176313b6869eeb29b8d48e0c8d80227fa6544 (patch)
treecc0128b36ea9b22207a3dd41a401ae4ecd131e74 /ext/net/ops_tls.rs
parentecc70eb58fd5531f3b93402cf781e93ef2bb4d64 (diff)
perf: lazily create RootCertStore (#18938)
Diffstat (limited to 'ext/net/ops_tls.rs')
-rw-r--r--ext/net/ops_tls.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs
index 8a7757066..b9b37b328 100644
--- a/ext/net/ops_tls.rs
+++ b/ext/net/ops_tls.rs
@@ -813,14 +813,10 @@ where
.try_borrow::<UnsafelyIgnoreCertificateErrors>()
.and_then(|it| it.0.clone());
- // TODO(@justinmchase): Ideally the certificate store is created once
- // and not cloned. The store should be wrapped in Arc<T> to reduce
- // copying memory unnecessarily.
let root_cert_store = state
.borrow()
.borrow::<DefaultTlsOptions>()
- .root_cert_store
- .clone();
+ .root_cert_store()?;
let resource_rc = state
.borrow_mut()
@@ -912,8 +908,7 @@ where
let root_cert_store = state
.borrow()
.borrow::<DefaultTlsOptions>()
- .root_cert_store
- .clone();
+ .root_cert_store()?;
let hostname_dns = ServerName::try_from(&*addr.hostname)
.map_err(|_| invalid_hostname(&addr.hostname))?;
let connect_addr = resolve_addr(&addr.hostname, addr.port)