From 9c6b2929d8019dcc11935550bc3520ae39c2964e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 30 Dec 2024 11:45:36 -0800 Subject: fixes #863 socket activation: for TCP and IPC (POSIX only) This introduces a new option "NNG_OPT_LISTEN_FD", understood by TCP, TLS, and (on POSIX systems) IPC. This option is used to pass a file descriptor or handle (Windows) that is already listening (ready for ACCEPT to be called). For TCP and TLS, the socket must be of type AF_INET or AF_INET6, and for IPC it must be of type AF_UNIX. --- include/nng/nng.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index d7deefd5..61c1171f 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -894,6 +894,13 @@ NNG_DECL nng_listener nng_pipe_listener(nng_pipe); // are not supported. #define NNG_OPT_SOCKET_FD "socket:fd" +// NNG_OPT_LISTEN_FD is a write-only integer property that can be used +// with some transports to pass a file descriptor that is already listening +// for inbound connections. The transport will then call accept on it. +// The file descriptor has to be of a suitable type. The intended use +// for this is socket activation. Not all transports support this. +#define NNG_OPT_LISTEN_FD "listen-fd" + // XXX: TBD: priorities, ipv4only // Statistics. These are for informational purposes only, and subject -- cgit v1.2.3-70-g09d2