Skip to content

Commit

Permalink
fix: remove async call and LogCtx
Browse files Browse the repository at this point in the history
The readlock in here could have been causing a deadlock
  • Loading branch information
joshuef committed Dec 22, 2022
1 parent c9c30ab commit 386bf37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 41 deletions.
2 changes: 1 addition & 1 deletion sn_interface/src/network_knowledge/mod.rs
Expand Up @@ -389,7 +389,7 @@ impl NetworkKnowledge {
continue;
}
trace!(
"Updating section members. Name: {:?}, new state: {:?}",
"Attempting to update section members. Name: {:?}, new state: {:?}",
node_state.name(),
node_state.state()
);
Expand Down
30 changes: 0 additions & 30 deletions sn_node/src/node/logging/log_ctx.rs

This file was deleted.

12 changes: 5 additions & 7 deletions sn_node/src/node/logging/mod.rs
Expand Up @@ -6,19 +6,17 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

pub(super) mod log_ctx;

use self::log_ctx::LogCtx;
use sysinfo::{System, SystemExt};
use tracing::trace;
use xor_name::Prefix;

pub(super) async fn log_system_details(ctx: LogCtx) {
pub(super) fn log_system_details(prefix: Prefix) {
let mut system = System::new_all();
initial_log(&mut system, &ctx).await;
initial_log(&mut system, prefix);
}

async fn initial_log(system: &mut System, ctx: &LogCtx) {
let prefix: &str = &format!("{}", ctx.prefix().await.name());
fn initial_log(system: &mut System, prefix: Prefix) {
let prefix: &str = &format!("{}", prefix.name());
let os_name: &str = &fmt(system.name());
let kernel_version: &str = &fmt(system.kernel_version());
let os_version: &str = &fmt(system.os_version());
Expand Down
6 changes: 3 additions & 3 deletions sn_node/src/node/node_starter.rs
Expand Up @@ -13,7 +13,7 @@ use crate::node::{
cmds::Cmd, dispatcher::Dispatcher, dysfunction::DysCmds, CmdCtrl, FlowCtrl, RejoinNetwork,
},
join_network,
logging::{log_ctx::LogCtx, log_system_details},
logging::log_system_details,
Config, Error, MyNode, Result, STANDARD_CHANNEL_SIZE,
};
use crate::UsedSpace;
Expand Down Expand Up @@ -121,9 +121,9 @@ async fn new_node(
"Node PID: {:?}, prefix: {:?}, name: {:?}, age: {}, connection info: {}",
our_pid, node_prefix, node_name, node_age, our_conn_info_json,
);
}

log_system_details(LogCtx::new(node.clone())).await;
log_system_details(node_prefix);
}

Ok((node, cmd_channel, rejoin_network_rx))
}
Expand Down

0 comments on commit 386bf37

Please sign in to comment.