Improve the logging of key user information

This commit is contained in:
decentclock
2022-07-26 18:17:33 -06:00
parent 0332edd5cf
commit f11e6dafab
3 changed files with 8 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ pub fn start_config_server_and_wait(
let httpd = conn::http::config_server(mutex.clone()); let httpd = conn::http::config_server(mutex.clone());
let mut wait = mutex.0.lock().unwrap(); let mut wait = mutex.0.lock().unwrap();
log::info!("Waiting for data from the phone!");
let config: &Config = loop { let config: &Config = loop {
if let Some(conf) = &*wait { if let Some(conf) = &*wait {

View File

@@ -1,5 +1,6 @@
use crate::conn::mqtt::{QOS, RETURN_TOPIC, TOPIC}; use crate::conn::mqtt::{QOS, RETURN_TOPIC, TOPIC};
use crate::core::init::make_init_msg; use crate::core::init::make_init_msg;
use crate::core::config::Config;
use sphinx_key_signer::lightning_signer::bitcoin::Network; use sphinx_key_signer::lightning_signer::bitcoin::Network;
use sphinx_key_signer::vls_protocol::model::PubKey; use sphinx_key_signer::vls_protocol::model::PubKey;
@@ -41,8 +42,10 @@ pub fn make_event_loop(
do_log: bool, do_log: bool,
led_tx: mpsc::Sender<Status>, led_tx: mpsc::Sender<Status>,
seed: [u8; 32], seed: [u8; 32],
config: Config
) -> Result<()> { ) -> Result<()> {
while let Ok(event) = rx.recv() { while let Ok(event) = rx.recv() {
log::info!("BROKER IP AND PORT: {}", config.broker);
match event { match event {
Event::Connected => { Event::Connected => {
log::info!("SUBSCRIBE to {}", TOPIC); log::info!("SUBSCRIBE to {}", TOPIC);

View File

@@ -84,18 +84,18 @@ fn main() -> Result<()> {
}; };
log::info!("Network set to {:?}", network); log::info!("Network set to {:?}", network);
log::info!(">>>>>>>>>>> blocking forever..."); log::info!(">>>>>>>>>>> blocking forever...");
make_event_loop(mqtt_client, rx, network, do_log, led_tx, exist.seed)?; log::info!("{:?}", exist);
make_event_loop(mqtt_client, rx, network, do_log, led_tx, exist.seed, exist)?;
} else { } else {
led_tx.send(Status::WifiAccessPoint).unwrap(); led_tx.send(Status::WifiAccessPoint).unwrap();
println!("=============> START SERVER NOW AND WAIT <=============="); println!("=============> START SERVER NOW AND WAIT <==============");
if let Ok((wifi, config)) = start_config_server_and_wait(default_nvs.clone()) { if let Ok((_wifi, config)) = start_config_server_and_wait(default_nvs.clone()) {
let conf = rmp_serde::to_vec(&config).expect("couldnt rmp Config"); let conf = rmp_serde::to_vec(&config).expect("couldnt rmp Config");
store store
.put_raw("config", &conf[..]) .put_raw("config", &conf[..])
.expect("could not store config"); .expect("could not store config");
println!("CONFIG SAVED"); println!("CONFIG SAVED");
drop(wifi); loop {};
thread::sleep(Duration::from_secs(1));
} }
} }