folly::ShutdownSocketSet

Set of sockets that allows immediate, take-no-prisoners abort.

Synopsis

Declared in <folly/io/ShutdownSocketSet.h>

class ShutdownSocketSet;

Member Functions

NameDescription
ShutdownSocketSet [constructor]Constructors
operator= [deleted]Deleted copy assignment; the set is non-copyable.
add Add an already open socket to the list of sockets managed by ShutdownSocketSet. You MUST close the socket by calling ShutdownSocketSet::close (which will, as a side effect, also handle EINTR properly) and not by calling close() on the file descriptor.
close Close a socket managed by ShutdownSocketSet. Returns the same return code as ::close() (and sets errno accordingly).
remove Remove a socket from the list of sockets managed by ShutdownSocketSet. Note that remove() might block! (which we lamely implement by sleep()-ing) in the extremely rare case that the fd is currently being shutdown().
shutdown Shut down a socket. If abortive is true, we perform an abortive shutdown (send RST rather than FIN). Note that we might still end up sending FIN due to the rather interesting implementation.
shutdownAll Immediate shutdown of all connections. This is a hard-hitting hammer; all reads and writes will return errors and no new connections will be accepted.

Non-Member Functions

NameDescription
tryGetShutdownSocketSetReturns the process-global shutdown socket set, if one has been installed.
tryGetShutdownSocketSetFastReturns the process-global shutdown socket set using a read-mostly pointer.