diff options
author | Michael Adam <obnox@samba.org> | 2013-11-08 08:07:08 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-09 13:34:33 +0100 |
commit | 2ebfd456eff002cfba45aa88dad4b2a0cb9edc1a (patch) | |
tree | bf59f92d58694bfc3a5da14fd40e7cef61db38e2 /src/sock.c | |
parent | 070d6215340379cbea7cc404ff4bb450a0ddea8b (diff) |
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>
Diffstat (limited to 'src/sock.c')
-rw-r--r-- | src/sock.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } /* |