recv: hoist RECV_BATCH_MAX into hive-sh4re, drop magic 5 in wake hint

This commit is contained in:
damocles 2026-07-02 22:22:03 +02:00 committed by mara
commit be5b36911a
3 changed files with 17 additions and 10 deletions

View file

@ -149,13 +149,10 @@ async fn serve(stream: UnixStream, agent: String, coord: Arc<Coordinator>) -> Re
/// positive `wait_seconds`.
pub(crate) const RECV_LONG_POLL_MAX: std::time::Duration = std::time::Duration::from_mins(3);
/// Server-side hard cap on `Recv.max`. Bounds the size of a single
/// round-trip so a confused caller can't drain the entire inbox in
/// one go and blow past wire-buffer sizes; everything above the cap
/// silently clamps. 5 keeps individual turns small — a big backlog
/// is drained over several recv calls instead of one giant pop
/// (#2150).
pub(crate) const RECV_BATCH_MAX: u32 = 5;
/// Server-side hard cap on `Recv.max` — canonical value lives in
/// `hive_sh4re::RECV_BATCH_MAX` so the harness's wake-prompt hint and
/// this enforcement site can't drift apart (#2150).
pub(crate) const RECV_BATCH_MAX: u32 = hive_sh4re::RECV_BATCH_MAX;
pub(crate) fn recv_timeout(wait_seconds: Option<u64>) -> std::time::Duration {
match wait_seconds {