Rename FrontendEvent to FrontendRequest (#111)

* rename frontend event and notify
* simplify event names
This commit is contained in:
Ferdinand Schober
2024-04-25 22:18:43 +02:00
committed by GitHub
parent 9edd2f7f3b
commit 279e582698
7 changed files with 97 additions and 92 deletions

View File

@@ -7,13 +7,13 @@ use tokio::{
task::JoinHandle,
};
use crate::{event::Event, frontend::FrontendNotify};
use crate::{event::Event, frontend::FrontendEvent};
use super::Server;
pub async fn new(
server: Server,
frontend_notify_tx: Sender<FrontendNotify>,
frontend_notify_tx: Sender<FrontendEvent>,
) -> Result<(
JoinHandle<()>,
Sender<(Event, SocketAddr)>,
@@ -55,12 +55,12 @@ pub async fn new(
Ok(new_socket) => {
socket = new_socket;
server.port.replace(port);
let _ = frontend_notify_tx.send(FrontendNotify::NotifyPortChange(port, None)).await;
let _ = frontend_notify_tx.send(FrontendEvent::PortChanged(port, None)).await;
}
Err(e) => {
log::warn!("could not change port: {e}");
let port = socket.local_addr().unwrap().port();
let _ = frontend_notify_tx.send(FrontendNotify::NotifyPortChange(
let _ = frontend_notify_tx.send(FrontendEvent::PortChanged(
port,
Some(format!("could not change port: {e}")),
)).await;