diff options
| -rw-r--r-- | mumd/src/main.rs | 7 | ||||
| -rw-r--r-- | mumd/src/network/tcp.rs | 9 | ||||
| -rw-r--r-- | mumd/src/network/udp.rs | 4 | ||||
| -rw-r--r-- | mumd/src/state.rs | 3 |
4 files changed, 9 insertions, 14 deletions
diff --git a/mumd/src/main.rs b/mumd/src/main.rs index c923857..812e7a1 100644 --- a/mumd/src/main.rs +++ b/mumd/src/main.rs @@ -12,17 +12,14 @@ use argparse::Store; use argparse::StoreTrue; use colored::*; use tokio::sync::oneshot; -use futures::{join, select}; +use futures::join; use log::*; use mumble_protocol::control::ControlPacket; use mumble_protocol::crypt::ClientCryptState; use mumble_protocol::voice::Serverbound; use std::sync::{Arc, Mutex}; use tokio::sync::{mpsc, watch}; -use std::thread; use std::time::Duration; -use tokio::stream::StreamExt; -use futures::FutureExt; #[tokio::main] async fn main() { @@ -85,7 +82,7 @@ async fn main() { command_sender.send(Command::ServerConnect{host: server_host, port: server_port, username: username.clone(), accept_invalid_cert}); //command_sender.send(Command::ChannelJoin{channel_id: 1}).unwrap(); command_sender.send(Command::ChannelList).unwrap(); - let state = State::new(packet_sender, command_sender.clone(), connection_info_sender, username); + let state = State::new(packet_sender, command_sender.clone(), connection_info_sender); let state = Arc::new(Mutex::new(state)); // Run it diff --git a/mumd/src/network/tcp.rs b/mumd/src/network/tcp.rs index 0aca19e..1e0feee 100644 --- a/mumd/src/network/tcp.rs +++ b/mumd/src/network/tcp.rs @@ -16,7 +16,6 @@ use tokio::sync::{mpsc, watch}; use tokio::time::{self, Duration}; use tokio_tls::{TlsConnector, TlsStream}; use tokio_util::codec::{Decoder, Framed}; -use futures_util::core_reexport::cell::RefCell; type TcpSender = SplitSink< Framed<TlsStream<TcpStream>, ControlCodec<Serverbound, Clientbound>>, @@ -44,7 +43,7 @@ pub async fn handle( .await; // Handshake (omitting `Version` message for brevity) - let mut state_lock = state.lock().unwrap(); + let state_lock = state.lock().unwrap(); authenticate(&mut sink, state_lock.username().unwrap().to_string()).await; let phase_watcher = state_lock.phase_receiver(); let packet_sender = state_lock.packet_sender(); @@ -102,7 +101,7 @@ async fn send_pings( let (tx, rx) = oneshot::channel(); let phase_transition_block = async { while !matches!(phase_watcher.recv().await.unwrap(), StatePhase::Disconnected) {} - tx.send(true); + tx.send(true).unwrap(); }; let mut interval = time::interval(Duration::from_secs(delay_seconds)); @@ -141,7 +140,7 @@ async fn send_packets( let (tx, rx) = oneshot::channel(); let phase_transition_block = async { while !matches!(phase_watcher.recv().await.unwrap(), StatePhase::Disconnected) {} - tx.send(true); + tx.send(true).unwrap(); }; let main_block = async { @@ -191,7 +190,7 @@ async fn listen( let (tx, rx) = oneshot::channel(); let phase_transition_block = async { while !matches!(phase_watcher.recv().await.unwrap(), StatePhase::Disconnected) {} - tx.send(true); + tx.send(true).unwrap(); }; let listener_block = async { diff --git a/mumd/src/network/udp.rs b/mumd/src/network/udp.rs index ab4ca1d..a757a2b 100644 --- a/mumd/src/network/udp.rs +++ b/mumd/src/network/udp.rs @@ -75,7 +75,7 @@ async fn listen( let (tx, rx) = oneshot::channel(); let phase_transition_block = async { while !matches!(phase_watcher.recv().await.unwrap(), StatePhase::Disconnected) {} - tx.send(true); + tx.send(true).unwrap(); }; let main_block = async { @@ -185,7 +185,7 @@ async fn send_voice( let (tx, rx) = oneshot::channel(); let phase_transition_block = async { while !matches!(phase_watcher.recv().await.unwrap(), StatePhase::Disconnected) {} - tx.send(true); + tx.send(true).unwrap(); }; let main_block = async { diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 0de29f1..016783b 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -36,7 +36,6 @@ impl State { packet_sender: mpsc::UnboundedSender<ControlPacket<Serverbound>>, command_sender: mpsc::UnboundedSender<Command>, connection_info_sender: watch::Sender<Option<ConnectionInfo>>, - username: String, ) -> Self { Self { server: Server::new(), @@ -87,7 +86,7 @@ impl State { socket_addr, host, accept_invalid_cert, - ))); + ))).unwrap(); (true, Ok(None)) } Command::Status => { |
