Expand description
Helpers for the listening sockets of the server: private sockets, socket paths of any length and the errors of the accept loops.
Structsยง
- Accept
Errors ๐ - The failed accepts of a listener which keeps going.
- Socket
InUse ๐ - A socket which a running process still serves, so it must not be replaced. A type of its own tells it apart from other errors, like for the tests, which retry while a process they forked holds a socket.
Constantsยง
- ACCEPT_
BACKOFF ๐ - How long an accept loop pauses after a failed accept.
- ACCEPT_
ERROR_ ๐INTERVAL - How often the failed accepts of a listener get logged as errors, a
server out of descriptors would log one every
ACCEPT_BACKOFFotherwise.
Functionsยง
- bind_
long_ ๐path - Bind a listener with
bindat a socket path whatever its length, seeshorten_path. The parent directory gets created if it does not exist. The callers name the socket in the error of a failed bind. - connection_
failed ๐ - Whether an accept failed for the connection only, which the client aborted or reset before it got accepted.
- listen_
private ๐ - Listen on a stream socket at
pathwhich only its owner can connect to, seeprivate_socket. - private_
socket ๐ - Create a non-blocking UNIX socket which only its owner can connect to. Linux creates the file of a socket on bind with the mode of the socket minus the umask, so others cannot connect at any time, unlike with a chmod after the bind.
- shorten_
path ๐ - Refer to a socket path through its parent directory, so that it fits into a socket address whatever its length. The directory has to exist and stays open as long as the returned file, the path is only valid until then.
- shorten_
socket_ ๐path - Like
shorten_path, creating the parent directory if it does not exist. - split_
socket_ ๐path - Split a socket path into its parent directory and name, a relative name lives in the current directory.