From 9245c666afa5bfe42127a10f93e467a060a7ccee Mon Sep 17 00:00:00 2001 From: DuProcess <273172371+DuProcess@users.noreply.github.com> Date: Fri, 17 Jul 2026 20:08:39 -0400 Subject: [PATCH] Bound reliable stream bursts for terminal fairness --- src/bin/dosh-client.rs | 2 +- src/bin/dosh-server/unix.rs | 2 +- src/transport.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bin/dosh-client.rs b/src/bin/dosh-client.rs index 7cdf62e..2fb1a61 100644 --- a/src/bin/dosh-client.rs +++ b/src/bin/dosh-client.rs @@ -67,7 +67,7 @@ use tokio::net::windows::named_pipe::{ClientOptions, NamedPipeClient}; use tokio::net::{TcpListener, TcpStream, UdpSocket}; use tokio::sync::mpsc; -const STREAM_INITIAL_WINDOW: usize = 1024 * 1024; +const STREAM_INITIAL_WINDOW: usize = dosh::transport::DEFAULT_INITIAL_WINDOW; const STREAM_RETIRED_TOMBSTONES: usize = 16 * 1024; const STREAM_CONTROL_RETRANSMIT_MAX_ATTEMPTS: u32 = 8; const MAX_PENDING_USER_INPUT_BYTES: usize = 1024 * 1024; diff --git a/src/bin/dosh-server/unix.rs b/src/bin/dosh-server/unix.rs index bd470a0..f712d15 100644 --- a/src/bin/dosh-server/unix.rs +++ b/src/bin/dosh-server/unix.rs @@ -48,7 +48,7 @@ use tokio::net::{TcpListener, TcpStream, UdpSocket, UnixListener}; use tokio::process::Command as TokioCommand; use tokio::sync::mpsc; -const STREAM_INITIAL_WINDOW: usize = 1024 * 1024; +const STREAM_INITIAL_WINDOW: usize = dosh::transport::DEFAULT_INITIAL_WINDOW; const STREAM_RETIRED_TOMBSTONES: usize = 16 * 1024; const STREAM_CONTROL_RETRANSMIT_MAX_ATTEMPTS: u32 = 8; diff --git a/src/transport.rs b/src/transport.rs index 3550590..c8e3019 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -31,7 +31,10 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use tokio::net::UdpSocket; -pub const DEFAULT_INITIAL_WINDOW: usize = 1024 * 1024; +/// Per-stream bytes allowed in flight before window credit returns. This bounds +/// each sender burst to 64 MTU-safe packets so bulk streams cannot starve the +/// terminal while retaining useful bandwidth on high-latency links. +pub const DEFAULT_INITIAL_WINDOW: usize = 64 * 1024; pub const DEFAULT_RETRANSMIT_AFTER: Duration = Duration::from_millis(200); pub const ADAPTIVE_RETRANSMIT_PAD: Duration = Duration::from_millis(10); pub const ADAPTIVE_RETRANSMIT_MIN: Duration = Duration::from_millis(10);