Skip to main content

Module sockets

Module sockets 

Source
Expand description

Socket quota tracking and WASI socket host implementations.

This module provides SocketPermitState, SpinSocketsView, and SpinSockets — the types needed to intercept WASI TCP/UDP socket creation and enforce a per-app cap on the number of concurrently open sockets.

Structs§

SocketPermitState
Shared state for tracking per-socket semaphore permits. Permits are acquired when a socket is allocated (at start_connect for TCP, at create_udp_socket for UDP) and released when the socket resource is dropped.
SpinSockets
HasData accessor for SpinSocketsView, used in place of [WasiSockets] when registering TCP socket bindings so that start_connect and drop can participate in socket quota tracking.
SpinSocketsView
A view over WASI socket state that carries an optional per-instance socket permit store, enabling per-connection quota tracking.