Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
do some tests and remove some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
musitdev committed Jan 24, 2024
1 parent 7e0bb1b commit aee1b58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
20 changes: 5 additions & 15 deletions crates/node/src/asset_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ impl AssetManager {
loop {
for tx_hash in self.database.get_incomplete_assets().await? {
if let Some(tx) = self.database.find_transaction(&tx_hash).await? {
tracing::info!(
"ICI AssetManager run asset find_transaction hash: {}",
&tx_hash
);
if let Err(err) = self.process_transaction(&tx).await {
tracing::error!(
"failed to process transaction (hash: {}) assets: {}",
Expand Down Expand Up @@ -171,11 +167,6 @@ impl AssetManager {
// TODO: Blocking operation.
std::fs::create_dir_all(file_path.parent().unwrap())?;

tracing::info!(
"ICI download file to {}",
file_path.as_path().to_str().unwrap().to_string()
);

let mut resp = match self.http_client.get(url.clone()).send().await {
Ok(resp) => resp,
Err(err) => {
Expand All @@ -197,7 +188,6 @@ impl AssetManager {
})?;
let peer_urls: Vec<_> = {
let list = self.http_peer_list.read().await;
tracing::info!("ICI download get from uri {uri}, peer list:{:?}", list);
list.iter()
.filter_map(|(peer, port)| {
port.map(|port| {
Expand All @@ -211,7 +201,11 @@ impl AssetManager {
})
.collect()
};
tracing::info!("ICI download get from uri {uri}, peer list:{:?}", peer_urls);
tracing::debug!(
"asset manager download file from uri {uri} to {}, use peer list:{:?}",
file_path.as_path().to_str().unwrap().to_string(),
peer_urls
);

let mut resp = None;
for url in peer_urls {
Expand Down Expand Up @@ -249,10 +243,6 @@ impl AssetManager {
fd.flush().await?;
//rename to original name
std::fs::rename(tmp_file_path, file_path)?;
tracing::info!(
"downloaded file to {}",
file_path.as_path().to_str().unwrap().to_string()
);
} else {
tracing::error!(
"failed to download file from {}: response status: {}",
Expand Down
3 changes: 0 additions & 3 deletions crates/node/src/mempool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ impl Mempool {
}

pub async fn add(&mut self, tx: Transaction) -> Result<()> {
tracing::info!("ICI Mempool Add Tx:{:?}", tx);

// First validate transaction.
tx.validate()?;

Expand All @@ -84,7 +82,6 @@ impl Mempool {
// Broadcast new transaction to P2P network if it's configured.
if !tx.propagated {
if let Some(ref tx_chan) = self.tx_chan {
tracing::info!("ICI Mempool propagate Tx");
if tx_chan.send_tx(&tx).await.is_ok() {
tx.propagated = true;
self.storage.set(&tx).await?;
Expand Down
2 changes: 0 additions & 2 deletions crates/node/src/networking/download_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use tokio_util::io::ReaderStream;
pub async fn serve_files(config: &Config) -> Result<JoinHandle<()>> {
let mut bind_addr = config.p2p_listen_addr.clone();
bind_addr.set_port(config.http_download_port);
tracing::info!("ICI start http download manager bind_addr:{}", bind_addr);
let listener = TcpListener::bind(bind_addr).await?;

let jh = tokio::spawn({
Expand All @@ -40,7 +39,6 @@ pub async fn serve_files(config: &Config) -> Result<JoinHandle<()>> {
match listener.accept().await {
Ok((stream, _from)) => {
let io = TokioIo::new(stream);
tracing::info!("ICI DownloadManager get connection from:{}", _from);
tokio::task::spawn({
let data_directory = data_directory.clone();
async move {
Expand Down
4 changes: 1 addition & 3 deletions crates/node/src/networking/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ impl Handshake for P2P {
}
};

tracing::info!(
"ICI New connection: local:{local_bind_addr} distant:{distant_listening_addr}"
);
tracing::trace!("New connection: local:{local_bind_addr} distant:{distant_listening_addr}");

//do peer comparition
let mut local_diff = {
Expand Down

0 comments on commit aee1b58

Please sign in to comment.