A stable, lightweight identity for a socket owned by a SmolNet stack.
Socket values are not processes. Operations are serialized by the stack
process identified in the :stack field. The native socket ID and generation
together prevent delayed readiness from addressing a later socket.
Summary
Functions
Cancels the exact pending operation described by select_info.
Types
@type datagram() :: %{ source: sockaddr_in() | sockaddr_in6(), destination: sockaddr_in() | sockaddr_in6(), data: binary(), truncated: boolean() }
@type ipv4_address() :: {0..255, 0..255, 0..255, 0..255}
@type ipv6_address() ::
{0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535,
0..65535}
@type sockaddr_in6() :: %{ :family => :inet6, :addr => ipv6_address(), :port => 0..65535, optional(:flowinfo) => 0, optional(:scope_id) => 0..4_294_967_295 }
@type sockaddr_in() :: %{family: :inet, addr: ipv4_address(), port: 0..65535}
@type t() :: %SmolNet.Socket{ family: :inet | :inet6, generation: pos_integer(), id: pos_integer(), kind: :stream | :datagram, stack: pid() }
Functions
@spec cancel(t(), :socket.select_info()) :: :ok | :already_sent | :not_found | {:error, :closed | :invalid_socket}
Cancels the exact pending operation described by select_info.
Returns :ok when the waiter was removed, :already_sent when its one-shot
readiness notification won the race, or :not_found when the reference does
not identify the pending operation.