server: low-priority follow-ups from the connection-error review

Open
#311 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Start with the server connection handling around ConnectionClosed::error(), the accept loop, serve_connection, and BoundServer::with_connection_extensions. Review how Windows and non-Windows errors, hyper re-exports, and the compile-fail doctest are currently handled. Done means each listed follow-up has focused coverage or validation without changing the public behavior incompatibly.

Written by the indexing model from the issue text.

Description

Low-priority follow-ups from the review of #310. None is a defect, and each can land without a breaking change.

  • A typed error for a panicking connection-extensions function. ConnectionClosed::error() reports such a panic as a string error, so a caller can tell it apart from a transport failure only by its message. A small public, #[non_exhaustive] error type would let callers downcast_ref it.
  • libc only on non-Windows targets. The server uses libc only for EMFILE / ENFILE; on Windows the fd-exhaustion check matches WSAEMFILE instead, so libc could become a cfg(not(windows)) dependency.
  • WSAENOBUFS (10055) on Windows. Winsock can return it from accept when system-wide socket resources run out, the analogue of ENFILE. Check how std classifies it, and whether the accept loop should pause on it too.
  • Re-exporting hyper. Classifying ConnectionClosed::error() (for example, hyper::Error::is_timeout for a header-read timeout) needs the caller's own hyper dependency, as does naming hyper::body::Incoming in the free serve_connection bound. A server-gated pub use hyper; would remove that.
  • The compile_fail,E0596 doctest on BoundServer::with_connection_extensions. rustdoc checks the error code only on nightly, so on stable the test passes for any compile error. A compiling no_run twin sits next to it; a nightly doctest job, or a trybuild test, would pin the code.
Dominant language
Rust
Stars
544
Forks
77
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from connectrpc/connect-rust

All issues in connectrpc/connect-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.