Skip to content
Snippets Groups Projects
Commit 4eb76fd1 authored by insert's avatar insert
Browse files

Fix mutex issues.

parent 3c785227
No related merge requests found
Pipeline #672 passed with stage
in 9 minutes and 14 seconds
......@@ -163,10 +163,15 @@ async fn accept(stream: TcpStream) {
// ! Could just run permission check here.
ServerboundNotification::BeginTyping { channel } => {
if mutex.lock().unwrap().is_some() {
let user = {
let mutex = mutex.lock().unwrap();
let session = mutex.as_ref().unwrap();
session.user_id.clone()
};
ClientboundNotification::ChannelStartTyping {
id: channel.clone(),
// lol
user: mutex.lock().as_ref().unwrap().as_ref().unwrap().user_id.clone()
user
}
.publish(channel)
.await
......@@ -181,9 +186,15 @@ async fn accept(stream: TcpStream) {
}
ServerboundNotification::EndTyping { channel } => {
if mutex.lock().unwrap().is_some() {
let user = {
let mutex = mutex.lock().unwrap();
let session = mutex.as_ref().unwrap();
session.user_id.clone()
};
ClientboundNotification::ChannelStopTyping {
id: channel.clone(),
user: mutex.lock().as_ref().unwrap().as_ref().unwrap().user_id.clone()
user
}
.publish(channel)
.await
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment