diff options
Diffstat (limited to 'mumd/src/command.rs')
| -rw-r--r-- | mumd/src/command.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mumd/src/command.rs b/mumd/src/command.rs index 9c8970c..e77b34b 100644 --- a/mumd/src/command.rs +++ b/mumd/src/command.rs @@ -1,11 +1,16 @@ +use crate::network::{ + ConnectionInfo, + tcp::{TcpEvent, TcpEventCallback}, + udp::PingRequest +}; use crate::state::{ExecutionContext, State}; -use crate::network::{tcp::{TcpEvent, TcpEventCallback}, udp::PingRequest}; use ipc_channel::ipc::IpcSender; use log::*; +use mumble_protocol::{Serverbound, control::ControlPacket}; use mumlib::command::{Command, CommandResponse}; use std::sync::{Arc, Mutex}; -use tokio::sync::{mpsc, oneshot}; +use tokio::sync::{mpsc, oneshot, watch}; pub async fn handle( state: Arc<Mutex<State>>, @@ -15,12 +20,14 @@ pub async fn handle( )>, tcp_event_register_sender: mpsc::UnboundedSender<(TcpEvent, TcpEventCallback)>, ping_request_sender: mpsc::UnboundedSender<PingRequest>, + mut packet_sender: mpsc::UnboundedSender<ControlPacket<Serverbound>>, + mut connection_info_sender: watch::Sender<Option<ConnectionInfo>>, ) { debug!("Begin listening for commands"); while let Some((command, response_sender)) = command_receiver.recv().await { debug!("Received command {:?}", command); let mut state = state.lock().unwrap(); - let event = state.handle_command(command); + let event = state.handle_command(command, &mut packet_sender, &mut connection_info_sender); drop(state); match event { ExecutionContext::TcpEvent(event, generator) => { |
