some debugging for bootstrap and route purge

This commit is contained in:
John Smith
2023-12-12 16:13:56 -05:00
committed by Christien Rioux
parent 97a9a8d3af
commit 7129343ea1
10 changed files with 25 additions and 11 deletions

View File

@@ -35,6 +35,7 @@ rt-tokio = [
tracking = ["veilid-core/tracking"]
network-result-extra = ["veilid-core/network-result-extra"]
verbose-tracing = ["veilid-core/verbose-tracing"]
debug-json-api = []
[dependencies]
veilid-core = { path = "../veilid-core", default-features = false }

View File

@@ -217,6 +217,9 @@ impl ClientApi {
// (trim all whitespace around input lines just to make things more permissive for API users)
let request: json_api::Request = deserialize_json(&sanitized_line)?;
#[cfg(feature = "debug-json-api")]
debug!("JSONAPI: Request: {:?}", request);
// See if this is a control message or a veilid-core message
let response = if let json_api::RequestOp::Control { args } = request.op {
// Process control messages
@@ -231,6 +234,9 @@ impl ClientApi {
jrp.clone().process_request(request).await
};
#[cfg(feature = "debug-json-api")]
debug!("JSONAPI: Response: {:?}", response);
// Marshal json + newline => NDJSON
let response_string = serialize_json(json_api::RecvMessage::Response(response)) + "\n";
if let Err(e) = responses_tx.send_async(response_string).await {