Skip to content

Commit

Permalink
dnetview: enable memory leak
Browse files Browse the repository at this point in the history
we enable dnet logs at the start of dnetview. we never disable them, so
this makes the switch logic pointless and reintroduces a memory leak.

we will push an update soon that also disables dnet logs.
  • Loading branch information
lunar-mining committed Aug 8, 2023
1 parent cc571fa commit 03d5c6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/dnetview/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ impl DataParser {
// On any failure, sleep and retry.
match RpcConnect::new(Url::parse(&node.rpc_url)?, node.name.clone()).await {
Ok(client) => {
// We start by enabling dnet
if let Err(e) = client.dnet_enable(true).await {
error!("dnet_enable error: {:?}", e);
}
if let Err(e) = self.poll(&node, client).await {
error!("Poll execution error: {:?}", e);
}
Expand Down
10 changes: 10 additions & 0 deletions bin/dnetview/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ impl RpcConnect {
Err(e) => Err(DnetViewError::Darkfi(e)),
}
}

// --> {"jsonrpc": "2.0", "method": "dnet_switch", "params": [true], "id": 42}
// <-- {"jsonrpc": "2.0", "result": true, "id": 42}
pub async fn dnet_enable(&self, params: bool) -> DnetViewResult<Value> {
let req = JsonRequest::new("dnet_switch", json!([params]));
match self.rpc_client.request(req).await {
Ok(req) => Ok(req),
Err(e) => Err(DnetViewError::Darkfi(e)),
}
}

// --> {"jsonrpc": "2.0", "method": "get_consensus_info", "params": [], "id": 42}
// <-- {"jsonrpc": "2.0", "result": {"nodeID": [], "nodeinfo" [], "id": 42}
Expand Down

0 comments on commit 03d5c6f

Please sign in to comment.