Append state event that pass resolution to DB, update to tokio 1.1

This commit is contained in:
Devin Ragotzy 2021-01-29 11:20:33 -05:00
parent b8b40ce38b
commit cd0c5c0566
6 changed files with 322 additions and 434 deletions

View file

@ -26,11 +26,7 @@ pub struct Globals {
}
impl Globals {
pub async fn load(
globals: sled::Tree,
server_keys: sled::Tree,
config: Config,
) -> Result<Self> {
pub fn load(globals: sled::Tree, server_keys: sled::Tree, config: Config) -> Result<Self> {
let bytes = &*globals
.update_and_fetch("keypair", utils::generate_keypair)?
.expect("utils::generate_keypair always returns Some");
@ -77,11 +73,9 @@ impl Globals {
config,
keypair: Arc::new(keypair),
reqwest_client,
dns_resolver: TokioAsyncResolver::tokio_from_system_conf()
.await
.map_err(|_| {
Error::bad_config("Failed to set up trust dns resolver with system config.")
})?,
dns_resolver: TokioAsyncResolver::tokio_from_system_conf().map_err(|_| {
Error::bad_config("Failed to set up trust dns resolver with system config.")
})?,
actual_destination_cache: Arc::new(RwLock::new(HashMap::new())),
servertimeout_signingkey: server_keys,
})