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 c = c.clone();
|
||||||
let server = server.clone();
|
let server = server.clone();
|
||||||
let msg = msg.clone();
|
let msg = msg.clone();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
server
|
if let Some(uuid) =
|
||||||
.wrap_err(&c, c.send(types::ServerMessage::MessageCreate(msg)))
|
LOGGER.extract(server.wrap_err(&c, c.get_uuid()), "Unable send message")
|
||||||
.expect("Failed to broadcast");
|
{
|
||||||
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -339,7 +339,10 @@ impl Client {
|
|||||||
|
|
||||||
impl Clone for Client {
|
impl Clone for Client {
|
||||||
fn clone(&self) -> Self {
|
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