MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / proxy_request_line_to_daemon

Function proxy_request_line_to_daemon

src/daemon.rs:1010–1051  ·  view source on GitHub ↗
(
    socket_path: &Path,
    handshake: &DaemonHandshake,
    line: &str,
    transport: &mut impl McpTransport,
)

Source from the content-addressed store, hash-verified

1008
1009#[cfg(unix)]
1010async fn proxy_request_line_to_daemon(
1011 socket_path: &Path,
1012 handshake: &DaemonHandshake,
1013 line: &str,
1014 transport: &mut impl McpTransport,
1015) -> Result<()> {
1016 if line.trim().is_empty() {
1017 return Ok(());
1018 }
1019
1020 match send_daemon_request_line(socket_path, handshake, line).await {
1021 Ok(responses) => {
1022 if let Some(warning) = daemon_version_skew_warning(line, &responses, binary_version()) {
1023 eprintln!("[tracedecay] warning: {warning}");
1024 }
1025 for response in responses {
1026 transport.write_line(&response).await?;
1027 if !response.ends_with('\n') {
1028 transport.write_line("\n").await?;
1029 }
1030 }
1031 transport.flush().await?;
1032 }
1033 Err(err) => {
1034 if let Some(response) = daemon_proxy_error_response(line, &err) {
1035 let json_line = serde_json::to_string(&response)?;
1036 transport.write_line(&json_line).await?;
1037 transport.write_line("\n").await?;
1038 transport.flush().await?;
1039 } else {
1040 log_daemon_event(
1041 "daemon_proxy_drop",
1042 &[
1043 ("outcome", "dropped_notification".to_string()),
1044 ("error", err.to_string()),
1045 ],
1046 );
1047 }
1048 }
1049 }
1050 Ok(())
1051}
1052
1053#[cfg(unix)]
1054async fn send_daemon_request_line(

Callers 1

Calls 8

send_daemon_request_lineFunction · 0.85
binary_versionFunction · 0.85
log_daemon_eventFunction · 0.85
is_emptyMethod · 0.45
write_lineMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected