32 lines
883 B
Rust

use sieverman::ConnectionInfo;
use tracing::info;
use crate::protocol::BackToFront;
pub(crate) async fn run(
to_frontend_tx: tokio::sync::mpsc::Sender<BackToFront>,
) -> anyhow::Result<()> {
info!("Starting up sieverman…");
info!("Creating connection info");
let info = ConnectionInfo::new("teilgedanken.de", 4190);
info!("connecting…");
let future_info = info.connect();
info!("waiting for the connection to be established");
let mut connected = match future_info.await {
Ok(v) => v,
Err(e) => {
info!("Failed to connect: {:?}", e);
panic!("Something went wrong");
}
};
info!("Fully read the introduction:");
to_frontend_tx
.send(BackToFront::ServerConnected(
connected.get_server_capabilities().clone(),
))
.await
.unwrap();
Ok(())
}