MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / send_error

Function send_error

nodedb/src/control/server/native/handshake.rs:116–125  ·  view source on GitHub ↗

Write a `HelloErrorFrame` and shut down the write side of the stream. Errors here are swallowed — we're already on the error path.

(stream: &mut S, code: HelloErrorCode, msg: &str)

Source from the content-addressed store, hash-verified

114///
115/// Errors here are swallowed — we're already on the error path.
116async fn send_error<S: AsyncWrite + Unpin>(stream: &mut S, code: HelloErrorCode, msg: &str) {
117 let frame = HelloErrorFrame {
118 code,
119 message: msg.to_string(),
120 }
121 .encode();
122 let _ = stream.write_all(&frame).await;
123 let _ = stream.flush().await;
124 let _ = stream.shutdown().await;
125}
126
127#[cfg(test)]
128mod tests {

Callers 1

perform_server_handshakeFunction · 0.85

Calls 4

to_stringMethod · 0.80
encodeMethod · 0.45
flushMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected