fix truncation check: use == instead of >= for buffer-full detection

recv_from can never return more bytes than the buffer size — the kernel
truncates silently. == is the correct heuristic for detecting truncation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Razvan Dimescu
2026-03-21 03:35:21 +02:00
parent 2cb87bbe83
commit 7a64e7c4aa

View File

@@ -23,7 +23,7 @@ pub async fn forward_query(
let mut recv_buffer = BytePacketBuffer::new(); let mut recv_buffer = BytePacketBuffer::new();
let (size, _) = timeout(timeout_duration, socket.recv_from(&mut recv_buffer.buf)).await??; let (size, _) = timeout(timeout_duration, socket.recv_from(&mut recv_buffer.buf)).await??;
if size >= recv_buffer.buf.len() { if size == recv_buffer.buf.len() {
log::debug!( log::debug!(
"upstream response truncated ({} bytes, buffer {})", "upstream response truncated ({} bytes, buffer {})",
size, size,