forked from jmug/stoatchat
Fix mutex issues.
This commit is contained in:
@@ -163,10 +163,15 @@ async fn accept(stream: TcpStream) {
|
|||||||
// ! Could just run permission check here.
|
// ! Could just run permission check here.
|
||||||
ServerboundNotification::BeginTyping { channel } => {
|
ServerboundNotification::BeginTyping { channel } => {
|
||||||
if mutex.lock().unwrap().is_some() {
|
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 {
|
ClientboundNotification::ChannelStartTyping {
|
||||||
id: channel.clone(),
|
id: channel.clone(),
|
||||||
// lol
|
user
|
||||||
user: mutex.lock().as_ref().unwrap().as_ref().unwrap().user_id.clone()
|
|
||||||
}
|
}
|
||||||
.publish(channel)
|
.publish(channel)
|
||||||
.await
|
.await
|
||||||
@@ -181,9 +186,15 @@ async fn accept(stream: TcpStream) {
|
|||||||
}
|
}
|
||||||
ServerboundNotification::EndTyping { channel } => {
|
ServerboundNotification::EndTyping { channel } => {
|
||||||
if mutex.lock().unwrap().is_some() {
|
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 {
|
ClientboundNotification::ChannelStopTyping {
|
||||||
id: channel.clone(),
|
id: channel.clone(),
|
||||||
user: mutex.lock().as_ref().unwrap().as_ref().unwrap().user_id.clone()
|
user
|
||||||
}
|
}
|
||||||
.publish(channel)
|
.publish(channel)
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user