diff options
| -rw-r--r-- | mumctl/src/main.rs | 11 | ||||
| -rw-r--r-- | mumd/src/main.rs | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index c6339f7..e8ac47f 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -7,6 +7,7 @@ use std::fs; fn main() { setup_logger(); + debug!("Logger up!"); let matches = App::new("mumctl") .setting(AppSettings::ArgRequiredElseHelp) @@ -33,6 +34,7 @@ fn main() { .subcommand(SubCommand::with_name("status")) .get_matches(); + debug!("Matching clap"); let command = if let Some(matches) = matches.subcommand_matches("server") { if let Some(matches) = matches.subcommand_matches("connect") { @@ -64,17 +66,18 @@ fn main() { } else { None }; + debug!("Matched {:#?}", &command); - debug!("Creating channel"); + debug!("Creating CommandResponse-channel"); let (tx_client, rx_client): (IpcSender<Result<Option<CommandResponse>, ()>>, IpcReceiver<Result<Option<CommandResponse>, ()>>) = ipc::channel().unwrap(); let server_name = fs::read_to_string("/var/tmp/mumd-oneshot").unwrap(); //TODO don't panic - info!("Sending {:#?}", command); + info!("Sending {:#?}\n to {}", command, server_name); let tx0 = IpcSender::connect(server_name).unwrap(); tx0.send((command.unwrap(), tx_client)).unwrap(); - debug!("Reading response"); + debug!("Waiting for response"); let response = rx_client.recv().unwrap(); - debug!("\n{:#?}", response); + debug!("Received {:#?}", response); } diff --git a/mumd/src/main.rs b/mumd/src/main.rs index 8639c35..14a43c1 100644 --- a/mumd/src/main.rs +++ b/mumd/src/main.rs @@ -37,7 +37,6 @@ async fn main() { ); let state = Arc::new(Mutex::new(state)); - // Run it let (_, _, _, e) = join!( network::tcp::handle( Arc::clone(&state), @@ -54,7 +53,7 @@ async fn main() { state, command_receiver, ), - spawn_blocking(move || { + spawn_blocking(move || { // IpcSender is blocking receive_oneshot_commands(command_sender); }), ); @@ -68,11 +67,11 @@ fn receive_oneshot_commands( // create listener let (server, server_name): (IpcOneShotServer<(Command, IpcSender<Result<Option<CommandResponse>, ()>>)>, String) = IpcOneShotServer::new().unwrap(); fs::write("/var/tmp/mumd-oneshot", &server_name).unwrap(); - debug!("Listening for command at {}...", server_name); + debug!("Listening to {}", server_name); // receive command and response channel let (_, conn): (_, (Command, IpcSender<Result<Option<CommandResponse>, ()>>)) = server.accept().unwrap(); - debug!("Sending command {:?} to command handler", conn.0); + debug!("Sending to command handler: {:#?}", conn.0); command_sender.send(conn).unwrap(); } } |
