net: Install default CryptoProvider for TLS connections

This commit is contained in:
parazyd
2024-05-27 16:24:18 +02:00
parent 2e37330d0d
commit 225aeebe7d
2 changed files with 6 additions and 2 deletions

View File

@@ -99,8 +99,8 @@ to happen from time to time. As a workaround, we can configure an older
nightly version, which was known to work:
```shell
% rustup toolchain install nightly-2024-02-01
% rustup target add wasm32-unknown-unknown --toolchain nightly-2024-02-01
% rustup toolchain install nightly-2024-04-05
% rustup target add wasm32-unknown-unknown --toolchain nightly-2024-04-05
```
Now we can use that toolchain in `make` directly:

View File

@@ -19,6 +19,7 @@
use std::sync::Arc;
use futures::{stream::FuturesUnordered, TryFutureExt};
use futures_rustls::rustls::crypto::{ring, CryptoProvider};
use log::{debug, error, info, warn};
use smol::{lock::Mutex, stream::StreamExt};
use url::Url;
@@ -81,6 +82,9 @@ impl P2p {
pub async fn new(settings: Settings, executor: ExecutorPtr) -> P2pPtr {
let settings = Arc::new(settings);
// Register a CryptoProvider for rustls
CryptoProvider::install_default(ring::default_provider()).unwrap();
let self_ = Arc::new(Self {
executor,
hosts: Hosts::new(settings.clone()),