- fromNativeHandle returns an Effect that captures the builder's services,
as Socket.fromWebSocket does, and takes `{ receiveBuffer, onError }`.
Adapters pass their options straight through, and the node-shared
make/adopt glue and its casts go away
- NativeHandle gains an optional synchronous `trySend`. Core calls it
first, so a Bun write that goes out at once allocates no completion
closure (about 43 fewer bytes per write). When it refuses, core calls
`send` with the same datagram and Bun queues or reports what `trySend`
found, without a second native send
- node-shared exports the open planning, peer resolution, errno mapping
and constructor glue as @internal helpers; Bun and Deno use them
instead of their own copies, so the family rule lives in one place
- core sends no destination on a connected socket, as the NativeHandle
contract says, so adapters drop their `connected` checks
- ReaderState is the handle's NativeEvents, removing four closures per
reader and a call per packet
- writes keep `instanceof` for their destination check: the TypeId
guard costs 7-21% on writeAll per datagram
- NetAddress: simpler zone parsing and IPv6 segment shift
Adds deterministic core tests for the write parking path: a late send
completion after an interrupted write or writeAll must not resume a fiber
that has parked elsewhere, a masked parked write completes before its
interruption applies, and a parked writeAll resumes with success or with
the failing datagram's destination. TestHandle can now defer sendMany.
Compares BunDatagramSocket with raw Bun.udpSocket over loopback and
measures the core layer with a fake native handle, with the same workloads
and columns as the Node benchmark. Records the Bun 1.4.2 tier (b) baseline.
A write or writeAll whose native send completes synchronously (Bun) now
returns its result directly, and one that doesn't parks the fiber as pull
does instead of going through Effect.callback. Bun writes allocate about
40% less and cost about 20% less CPU per send; Node's async writes
allocate about 120 B less with CPU unchanged.
Build the Deno adapter on DatagramSocket.fromNativeHandle over
Deno.listenDatagram, checking for the unstable API when a reader opens.
Give DatagramSocketUnsupportedError a message naming the runtime and the
missing capability.
- gate reader exclusivity with a Latch instead of a hand-rolled waiter set
- register the scope finalizer only after the handle exists; the orphaned
open path frees the slot from the open fiber's observer
- cache the sticky failure exit instead of rebuilding it per pull/write
- derive scopeIds from the handle, share the payload encoder, drop the
redundant closed guards and per-write try/catch (the run loop already
turns a throwing register into a defect)