MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / read_one_message

Function read_one_message

tests/client_compat.rs:1241–1257  ·  view source on GitHub ↗
(stream: &mut impl Read)

Source from the content-addressed store, hash-verified

1239}
1240
1241fn read_one_message(stream: &mut impl Read) -> Result<RawBackendMessage> {
1242 let mut header = [0u8; 5];
1243 stream
1244 .read_exact(&mut header)
1245 .context("read backend message header")?;
1246 let len = i32::from_be_bytes([header[1], header[2], header[3], header[4]]);
1247 anyhow::ensure!(len >= 4, "invalid backend message length {len}");
1248 let body_len = (len - 4) as usize;
1249 let mut body = vec![0u8; body_len];
1250 stream
1251 .read_exact(&mut body)
1252 .context("read backend message body")?;
1253 Ok(RawBackendMessage {
1254 tag: header[0],
1255 body,
1256 })
1257}
1258
1259fn read_startup_error_sqlstate(stream: &mut impl Read) -> Result<Option<String>> {
1260 loop {

Callers 3

read_until_readyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected