Skip to content

No socket options after creation (setNoDelay, setKeepAlive) blocks Perry's node:net #34

Closed

Description

@proggeramlug

Perry's P1 migration (node:net on turnloop) cannot implement socket.setNoDelay(), setKeepAlive() or the other post-creation socket options: turnloop accepts nodelay only in ConnectOpts at creation, ListenOpts has no such field at all, and there is no API to change an option on a live handle.

Node exposes these as methods on a connected socket, and servers commonly call setNoDelay(true) per accepted connection, so an accepted turnloop socket cannot be configured at all today.

Expected: a typed, backend-neutral socket-option API on Loop, for example set_option(handle, SocketOption) with a small enum (NoDelay, KeepAlive { idle, interval, count }, ReuseAddr at bind time, Linger, RecvBufferSize, SendBufferSize, Ipv6Only, Broadcast, multicast joins for UDP), returning Unsupported per backend where the platform has no equivalent.

Also needed: options on accepted sockets (the listener's defaults should not be the only choice), and ListenOpts should carry the accepted-socket defaults it can apply cheaply.

Verification: per option, assert the change is visible through the OS (getsockopt), and that behaviour changes where observable (for example NoDelay on a small-write round trip). Native Linux/macOS/Windows; WASI 0.2/0.3 where wasi:sockets exposes the option, Unsupported otherwise; web Unsupported.

Activity

  1. proggeramlug commented on Sep 15, 2026

    @proggeramlug
    ContributorAuthor

    Implemented in #36 (merged 909e92f): Loop::set_option/get_option with 12 option variants, plus ListenOpts::accept_defaults applied after the OS accept and before the Accepted completion. Per-backend support matrix and the Unsupported cases are in docs/lanes/sockopts.md and DESIGN §7.7. Verified through independent getsockopt probes (including a dup'd-socket cross-check), a behavioural Linger(0) reset test, and the full Windows/Linux/WASI/web CI matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions