From f31584c8100e9d9f758859cd8863cc22f6a39510 Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 28 Aug 2025 09:39:52 +0200 Subject: [PATCH] bless --- out | 4 ---- src/native_node/network.rs | 1 - src/native_node/node.rs | 7 +++++-- src/watcher/executor.rs | 2 ++ src/watcher/parser.rs | 7 ++++--- 5 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 out diff --git a/out b/out deleted file mode 100644 index 52d8fd9..0000000 --- a/out +++ /dev/null @@ -1,4 +0,0 @@ -[?1049h┏InputPane━━━━━━━━━━━━━━━━━┓┏OutputPane━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃>┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛[?25l[INFO]21:14:03|StartedRenderer[?25l[INFO]21:14:03|StartedParser[?25l[INFO]21:14:03|StartedExecutor[?25l[INFO]21:14:03|StartedNode[?25l[INFO]21:14:03|BuildingChain[?25l[?25l[?25l[?25l[?25l[?25l[?25lc[?25l[?25l[?25l[?25lc[?25l[?25l[?25l [?25l [?25l[?25l[?25l>[?25l[INFO]21:14:08|Exec:Recievedechocommand[?25l[INFO]21:14:08|Parser:Receivedmessagefromwatcher[?25lUsage:Commands:nodeAblockchainnodeCLItoolclearhelpPrintthismessageorthehelpofthegivensubcommand(s)Options:-h,--helpPrinthelp[?25lc[?25l[?25l[?25la[?25l[?25l[?25l[?1049lHello, world! -[DEBUG] [src/watcher/renderer.rs:125] 21:14:11 | Renderer Exit - -[?25h \ No newline at end of file diff --git a/src/native_node/network.rs b/src/native_node/network.rs index 8dd14f7..2705466 100644 --- a/src/native_node/network.rs +++ b/src/native_node/network.rs @@ -104,7 +104,6 @@ impl node::NativeNode { } _ => { } } - } } } diff --git a/src/native_node/node.rs b/src/native_node/node.rs index c0d9803..612c2a6 100644 --- a/src/native_node/node.rs +++ b/src/native_node/node.rs @@ -1,5 +1,5 @@ use crate::core::{self, Blockchain, ValidationError}; -use crate::native_node::message::{self, ProtocolMessage}; +use crate::native_node::message::ProtocolMessage; use crate::seeds_constants::SEED_NODES; use crate::watcher::executor::ExecutorCommand; @@ -229,8 +229,11 @@ impl NativeNode { self.connect_to_seeds().await; }, NodeCommand::ConnectToPeer(addr) => { + self.log(msg!(INFO, "Received ConnectToPeer: {addr}")).await; if let Ok(addr_sock) = addr.parse::() { self.connect_to_peer(addr_sock).await; + } else { + self.log(msg!(ERROR, "Failed to Parse to sock_addr: {addr}")).await; } } NodeCommand::AddPeer { peer_id, addr, sender } => { @@ -257,7 +260,7 @@ impl NativeNode { }, NodeCommand::ListPeers => { self.log(msg!(INFO, "Received DebugListPeers command")).await; - self.list_peers(); + self.log(msg!(INFO, "{}", self.list_peers())).await; }, NodeCommand::ShowId => { self.log(msg!(INFO, "Received DebugListBlocks command")).await; diff --git a/src/watcher/executor.rs b/src/watcher/executor.rs index 7672c11..f0438d6 100644 --- a/src/watcher/executor.rs +++ b/src/watcher/executor.rs @@ -2,6 +2,7 @@ use crate::{native_node::node::NodeCommand, watcher::{ watcher::Watcher, rendere use tokio::sync::mpsc; use vlogger::*; +#[derive(Debug)] pub enum ExecutorCommand { NodeResponse(String), Echo(Vec), @@ -45,6 +46,7 @@ impl Executor { } async fn handle_node_cmd(&self, cmd: NodeCommand) { + Watcher::log(&self.render_tx, msg!(INFO, "Received Node Command: {cmd:?}")).await; self.send_node_cmd(cmd).await; // match cmd { diff --git a/src/watcher/parser.rs b/src/watcher/parser.rs index 419f8f3..0ee2b5c 100644 --- a/src/watcher/parser.rs +++ b/src/watcher/parser.rs @@ -31,7 +31,7 @@ impl Parser { } async fn exit(&mut self) { - self.print(msg!(DEBUG, "Parser Exit")).await; + self.log(msg!(DEBUG, "Parser Exit")).await; self.exit = true; } @@ -41,7 +41,7 @@ impl Parser { } } - pub async fn print(&self, msg: String) { + pub async fn log(&self, msg: String) { if let Err(e) = self.exec_tx.send(ExecutorCommand::Echo(vec![msg])).await { log!(ERROR, "Error response from exec: {e}"); } @@ -49,13 +49,14 @@ impl Parser { async fn listen(&mut self) { if let Ok(Some(mes)) = timeout(Duration::from_millis(400), self.rx.recv()).await { - self.print(msg!(INFO, "Parser: Received message from watcher")).await; + self.log(msg!(INFO, "Parser: Received message from watcher")).await; match mes { ParserCommand::ParseCmdString(s) => { let argv: Vec<&str> = std::iter::once(" ") .chain(s.split_whitespace()) .collect(); let cmd = cli(&argv); + self.log(msg!(INFO, "Sending command {cmd:?} to exec")).await; let _ = self.exec_tx.send(cmd).await; }, ParserCommand::Exit => {