aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/command.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-04-06 20:48:15 +0200
committerGitHub <noreply@github.com>2021-04-06 20:48:15 +0200
commit9c116d48765ae9c567a9588e64995c404c9c26ab (patch)
treea65da0e2a48b5f1f02e963c87edf8515851255ac /mumd/src/command.rs
parent06a765afc73ec1f8f2af27f4ea2730ddaaf05852 (diff)
parente01383af1c417666d42a802e44a1d1e98bbcf14e (diff)
downloadmum-9c116d48765ae9c567a9588e64995c404c9c26ab.tar.gz
Merge pull request #82 from rbran/main
Diffstat (limited to 'mumd/src/command.rs')
-rw-r--r--mumd/src/command.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/mumd/src/command.rs b/mumd/src/command.rs
index 3e462b1..7eec388 100644
--- a/mumd/src/command.rs
+++ b/mumd/src/command.rs
@@ -8,11 +8,11 @@ use crate::state::{ExecutionContext, State};
use log::*;
use mumble_protocol::{Serverbound, control::ControlPacket};
use mumlib::command::{Command, CommandResponse};
-use std::sync::Arc;
-use tokio::sync::{mpsc, oneshot, watch, Mutex};
+use std::sync::{Arc, RwLock};
+use tokio::sync::{mpsc, oneshot, watch};
pub async fn handle(
- state: Arc<Mutex<State>>,
+ state: Arc<RwLock<State>>,
mut command_receiver: mpsc::UnboundedReceiver<(
Command,
oneshot::Sender<mumlib::error::Result<Option<CommandResponse>>>,
@@ -25,7 +25,7 @@ pub async fn handle(
debug!("Begin listening for commands");
while let Some((command, response_sender)) = command_receiver.recv().await {
debug!("Received command {:?}", command);
- let mut state = state.lock().await;
+ let mut state = state.write().unwrap();
let event = state.handle_command(command, &mut packet_sender, &mut connection_info_sender);
drop(state);
match event {