dnetview: enable memory leak

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.
This commit is contained in:
lunar-mining
2023-08-08 16:26:13 +02:00
parent cc571fa5f1
commit 03d5c6f1d3
2 changed files with 14 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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}