Broadcasting

This commit is contained in:
2026-07-22 21:58:32 +02:00
parent 701c345c83
commit af11afb255
+16 -4
View File
@@ -1,5 +1,6 @@
use pulse_wire::PulseWire;
use tokio::{ use tokio::{
io::AsyncReadExt, io::{AsyncReadExt, AsyncWriteExt},
net::{ net::{
UnixListener, UnixListener,
unix::{OwnedReadHalf, OwnedWriteHalf}, unix::{OwnedReadHalf, OwnedWriteHalf},
@@ -65,8 +66,19 @@ impl TerminalServer {
Ok(()) Ok(())
} }
pub async fn broadcast(&mut self) -> tokio::io::Result<()> { pub async fn broadcast(
// for client in &mut self.clients {} &mut self,
Ok(()) message: pulse_wire::terminal::TerminalServerMessage,
) -> tokio::io::Result<()> {
let mut res = Ok(());
let msg = message.to_com();
for client in &mut self.clients {
if let Err(e) = client.write(&msg).await {
res = Err(e);
}
}
res
} }
} }