Module spirit_tokio::net::limits[][src]

Expand description

Handling limits and errors on listening sockets.

„Naked“ listening sockets have two important problems:

  • They sometimes return errors when accepting, which often terminates the stream. Most of these are actually recoverable error in practice, so the termination seldom makes sense.
  • They have no limit on how many active connections they have spawned, allowing the application to grow without limits and eat all OS resources.

This module provides tools to address these problems in the form of WithListenLimits wrapper. There are also type aliases for already wrapped sockets, like TcpListenWithLimits

Structs

Wrapper around a listener instance.

An implementation of ListenLimits that reads the limits from configuration.

One connection accepted through the Limited.

A wrapper around a listening socket Fragment that adds limits and error handling to it.

Traits

Additional configuration for limiting of connections & error handling when accepting.

Type Definitions

A convenience type alias for the default WithListenLimits case.