Rewrite all Errors into tls_errors if they happen as part of initializing TLS.

This commit is contained in:
Alex Miller 2020-03-06 11:06:19 -08:00
parent ac52b6b474
commit 9b760fae2d
1 changed files with 9 additions and 4 deletions

View File

@ -1001,10 +1001,15 @@ void Net2::initTLS() {
return;
}
#ifndef TLS_DISABLED
try {
boost::asio::ssl::context newContext(boost::asio::ssl::context::tls);
ConfigureSSLContext( tlsConfig.loadSync(), &newContext );
sslContextVar.set(ReferencedObject<boost::asio::ssl::context>::from(std::move(newContext)));
backgroundCertRefresh = reloadCertificatesOnChange( tlsConfig, &sslContextVar );
} catch (Error& e) {
TraceEvent("Net2TLSInitError").error(e);
throw tls_error();
}
#endif
tlsInitialized = true;
}