mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
put global trust-dns resolver in an Arc
This allows us to reference it in reqwest clients configuration.
This commit is contained in:
parent
33f3592612
commit
e98dd5b9a3
1 changed files with 14 additions and 13 deletions
|
|
@ -74,7 +74,7 @@ pub(crate) struct Service {
|
|||
pub(crate) tls_name_override: Arc<StdRwLock<TlsNameMap>>,
|
||||
pub(crate) config: Config,
|
||||
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
||||
dns_resolver: TokioAsyncResolver,
|
||||
dns_resolver: Arc<TokioAsyncResolver>,
|
||||
jwt_decoding_key: Option<jsonwebtoken::DecodingKey>,
|
||||
federation_client: reqwest::Client,
|
||||
default_client: reqwest::Client,
|
||||
|
|
@ -215,6 +215,18 @@ impl Service {
|
|||
};
|
||||
|
||||
let tls_name_override = Arc::new(StdRwLock::new(TlsNameMap::new()));
|
||||
let dns_resolver = Arc::new(
|
||||
TokioAsyncResolver::tokio_from_system_conf().map_err(|e| {
|
||||
error!(
|
||||
"Failed to set up trust dns resolver with system config: \
|
||||
{}",
|
||||
e
|
||||
);
|
||||
Error::bad_config(
|
||||
"Failed to set up trust dns resolver with system config.",
|
||||
)
|
||||
})?,
|
||||
);
|
||||
|
||||
let jwt_decoding_key = config.jwt_secret.as_ref().map(|secret| {
|
||||
jsonwebtoken::DecodingKey::from_secret(secret.as_bytes())
|
||||
|
|
@ -255,18 +267,7 @@ impl Service {
|
|||
config,
|
||||
reload_handles: reload_handles.map(|h| Arc::new(RwLock::new(h))),
|
||||
keypair: Arc::new(keypair),
|
||||
dns_resolver: TokioAsyncResolver::tokio_from_system_conf()
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Failed to set up trust dns resolver with system \
|
||||
config: {}",
|
||||
e
|
||||
);
|
||||
Error::bad_config(
|
||||
"Failed to set up trust dns resolver with system \
|
||||
config.",
|
||||
)
|
||||
})?,
|
||||
dns_resolver,
|
||||
actual_destination_cache: Arc::new(
|
||||
RwLock::new(WellKnownMap::new()),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue