From 2ebfd456eff002cfba45aa88dad4b2a0cb9edc1a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 8 Nov 2013 08:07:08 +0100 Subject: child: use a list of listen_fds instead of one single listenfd. This prepares listenting on multiple sockets, which will be ussed to fix listening on the wildcard (listen on both ipv6 and ipv4) and help add the support for multiple Listen statements in the config Signed-off-by: Michael Adam --- src/sock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/sock.c') diff --git a/src/sock.c b/src/sock.c index fe28de6..d2db37b 100644 --- a/src/sock.c +++ b/src/sock.c @@ -166,7 +166,7 @@ int socket_blocking (int sock) * Start listening on a socket. Create a socket with the selected port. * The socket fd is returned upon success, -1 upon error. */ -int listen_sock (const char *addr, uint16_t port) +int listen_sock (const char *addr, uint16_t port, vector_t listen_fds) { struct addrinfo hints, *result, *rp; char portstr[6]; @@ -174,6 +174,7 @@ int listen_sock (const char *addr, uint16_t port) const int on = 1; assert (port > 0); + assert (listen_fds != NULL); memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_family = AF_UNSPEC; @@ -224,9 +225,11 @@ int listen_sock (const char *addr, uint16_t port) return -1; } + vector_append(listen_fds, &listenfd, sizeof(int)); + freeaddrinfo (result); - return listenfd; + return 0; } /* -- cgit v1.2.3