fix 2 msg when send from_user = to_user
This commit is contained in:
1 parent
ab25ef7ba8
commit
941afa2485
2 files changed
+2565
-2259
No files matched your search
+5
-3
@@ -1374,9 +1374,11 @@ async fn handle_websocket(socket: WebSocket, state: Arc<AppState>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let users = recv_state.users.read().await;
|
let users = recv_state.users.read().await;
|
||||||
if let Some(recipient_tx) = users.get(&chat_msg.to_user) {
|
if chat_msg.to_user != chat_msg.from_user {
|
||||||
let message_json = serde_json::to_string(&chat_msg).unwrap();
|
if let Some(recipient_tx) = users.get(&chat_msg.to_user) {
|
||||||
let _ = recipient_tx.send(Message::Text(message_json));
|
let message_json = serde_json::to_string(&chat_msg).unwrap();
|
||||||
|
let _ = recipient_tx.send(Message::Text(message_json));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(sender_tx) = users.get(&username) {
|
if let Some(sender_tx) = users.get(&username) {
|
||||||
|
|||||||
+2560
-2256
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user