Skip to content

Commit

Permalink
add a few more debug prints to http_server
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-frmr committed Dec 25, 2023
1 parent 1845cf1 commit 6766c66
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub async fn http_server(
ws_path_bindings.clone(),
ws_senders.clone(),
send_to_loop.clone(),
print_tx.clone(),
)
.await;
}
Expand Down Expand Up @@ -368,6 +369,12 @@ async fn http_handler(
let path_bindings = path_bindings.read().await;

let Ok(route) = path_bindings.recognize(&original_path) else {
let _ = print_tx
.send(Printout {
verbosity: 1,
content: format!("http_server: no route found for {original_path}"),
})
.await;
return Ok(warp::reply::with_status(vec![], StatusCode::NOT_FOUND).into_response());
};
let bound_path = route.handler();
Expand Down Expand Up @@ -749,6 +756,7 @@ async fn handle_app_message(
ws_path_bindings: WsPathBindings,
ws_senders: WebSocketSenders,
send_to_loop: MessageSender,
print_tx: PrintSender,
) {
// when we get a Response, try to match it to an outstanding HTTP
// request and send it there.
Expand Down Expand Up @@ -828,6 +836,15 @@ async fn handle_app_message(
format!("/{}/{}", km.source.process, path)
};
}
let _ = print_tx
.send(Printout {
verbosity: 1,
content: format!(
"binding path {path} for {}, authenticated={authenticated}, local={local_only}, cached={cache}",
km.source.process
),
})
.await;
if !cache {
// trim trailing "/"
path_bindings.add(
Expand Down

0 comments on commit 6766c66

Please sign in to comment.