Improved messaging and fixed direct sending problems as well as uuid

This commit is contained in:
2025-10-04 21:59:35 +02:00
parent f5162cceeb
commit 4bd671de4c
2 changed files with 25 additions and 4 deletions
+21 -3
View File
@@ -33,13 +33,31 @@ pub fn send(
let c = c.clone();
let server = server.clone();
let msg = msg.clone();
std::thread::spawn(move || {
server
.wrap_err(&c, c.send(types::ServerMessage::MessageCreate(msg)))
.expect("Failed to broadcast");
if let Some(uuid) =
LOGGER.extract(server.wrap_err(&c, c.get_uuid()), "Unable send message")
{
if uuid != channel_id {
return;
}
LOGGER.extract(
server.wrap_err(&c, c.send(types::ServerMessage::MessageCreate(msg))),
"Failed to send message",
);
}
});
}
LOGGER.extract(
server.wrap_err(
&client,
client.send(types::ServerMessage::MessageCreate(msg)),
),
"Failed to send message",
);
Ok(())
}
+4 -1
View File
@@ -339,7 +339,10 @@ impl Client {
impl Clone for Client {
fn clone(&self) -> Self {
Client(self.0.try_clone().expect("failed to clone TcpStream"), None)
Client(
self.0.try_clone().expect("failed to clone TcpStream"),
self.1.clone(),
)
}
}