Improved messaging and fixed direct sending problems as well as uuid
This commit is contained in:
+21
-3
@@ -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
@@ -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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user