Fix rustls panic in example bots

This commit is contained in:
Joscha 2024-12-04 18:52:29 +01:00
parent 61f5559370
commit 7360bf96f8
5 changed files with 21 additions and 6 deletions

View file

@ -27,6 +27,7 @@ default-features = false
features = ["std", "derive", "deprecated"]
[dev-dependencies] # For example bot
rustls = "0.23.19"
tokio = { version = "1.42.0", features = ["rt-multi-thread"] }
[[example]]
@ -56,7 +57,6 @@ rust.redundant_lifetimes = "warn"
rust.single_use_lifetimes = "warn"
rust.unit_bindings = "warn"
rust.unnameable_types = "warn"
rust.unused_crate_dependencies = "warn"
rust.unused_import_braces = "warn"
rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"

View file

@ -1,5 +1,3 @@
#![allow(unused_crate_dependencies)]
// TODO Add description
// TODO Clean up and unify test bots
@ -94,6 +92,11 @@ impl HasStartTime for Bot {
#[tokio::main]
async fn main() {
// https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455247837
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.unwrap();
let (tx, mut rx) = mpsc::unbounded_channel();
let mut instances = Instances::new(ServerConfig::default());

View file

@ -1,6 +1,5 @@
//! Similar to the `testbot_manual` example, but using [`Instance`] to connect
//! to the room (and to reconnect).
#![allow(unused_crate_dependencies)]
use euphoxide::api::packet::ParsedPacket;
use euphoxide::api::{Data, Nick, Send};
@ -123,6 +122,11 @@ async fn on_packet(packet: ParsedPacket, snapshot: ConnSnapshot) -> Result<(), (
#[tokio::main]
async fn main() {
// https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455247837
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.unwrap();
let (tx, mut rx) = mpsc::unbounded_channel();
let _instance = ServerConfig::default()

View file

@ -1,6 +1,5 @@
//! Similar to the `testbot_manual` example, but using [`Instance`] to connect
//! to the room (and to reconnect).
#![allow(unused_crate_dependencies)]
use euphoxide::api::packet::ParsedPacket;
use euphoxide::api::{Data, Nick, Send};
@ -124,6 +123,11 @@ async fn on_packet(packet: ParsedPacket, snapshot: ConnSnapshot) -> Result<(), (
#[tokio::main]
async fn main() {
// https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455247837
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.unwrap();
let (tx, mut rx) = mpsc::unbounded_channel();
let mut instances = Instances::new(ServerConfig::default());

View file

@ -1,6 +1,5 @@
//! A small bot that doesn't use the `bot` submodule. Meant to show how the main
//! parts of the API fit together.
#![allow(unused_crate_dependencies)]
use std::error::Error;
use std::time::Duration;
@ -127,6 +126,11 @@ async fn on_packet(packet: ParsedPacket, conn_tx: &ConnTx, state: &State) -> Res
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455247837
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.unwrap();
let (mut conn, _) = Conn::connect(DOMAIN, ROOM, false, None, TIMEOUT).await?;
while let Ok(packet) = conn.recv().await {