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 <obnox@samba.org>
This commit is contained in:
Michael Adam committed 2013-11-09 13:34:33 +01:00
1 parent 070d621534
commit 2ebfd456ef
3 files changed
+90 -7

No files matched your search

+5 -2
View File
@@ -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;
}
/*