Skip to content

Add TCP timeouts and bounded delimiter reads#456

Open
lukewilliamboswell wants to merge 3 commits into
mainfrom
issue-437-tcp-timeouts
Open

Add TCP timeouts and bounded delimiter reads#456
lukewilliamboswell wants to merge 3 commits into
mainfrom
issue-437-tcp-timeouts

Conversation

@lukewilliamboswell

@lukewilliamboswell lukewilliamboswell commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • require an explicit deadline on every TCP connect, read, and write operation
  • apply connect deadlines across DNS resolution and every resolved address
  • require delimiter and line reads to specify both a byte limit and a deadline
  • distinguish timeout, unexpected EOF, and read-limit exhaustion errors
  • add local TCP tests for stalled connects, stalled reads, EOF, and delimiter-free over-limit streams

API direction

This intentionally changes the primary API instead of retaining compatibility variants:

  • Tcp.connect!(host, port, timeout_ms)
  • stream.read_up_to!(bytes, timeout_ms)
  • stream.read_exactly!(bytes, timeout_ms)
  • stream.read_until!(delimiter, max_bytes, timeout_ms)
  • stream.read_line!(max_bytes, timeout_ms)
  • stream.write!(bytes, timeout_ms)
  • stream.write_utf8!(text, timeout_ms)

There are no unbounded or separately named timeout methods to remove later.

Testing

  • cargo test --locked --lib
  • ./scripts/test.py --operation validate
  • ./scripts/test.py --operation build --no-build
  • ./scripts/test.py --operation run --target x64musl
  • generated Rust glue check

Closes #437

@lukewilliamboswell
lukewilliamboswell marked this pull request as ready for review July 22, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TCP timeouts and bounded delimiter reads

1 participant