Mercurial > dovecot > core-2.2
diff src/lib/network.c @ 3075:9cb91ed5a110 HEAD
Added backlog parameter for net_listen*().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 09 Jan 2005 18:51:03 +0200 |
parents | a307ddd22a3a |
children | 8d15fea729c2 |
line wrap: on
line diff
--- a/src/lib/network.c Sun Jan 09 02:49:18 2005 +0200 +++ b/src/lib/network.c Sun Jan 09 18:51:03 2005 +0200 @@ -9,8 +9,6 @@ #include <sys/un.h> #include <netinet/tcp.h> -#define LISTEN_BACKLOG 8 - union sockaddr_union { struct sockaddr sa; struct sockaddr_in sin; @@ -241,7 +239,7 @@ /* Listen for connections on a socket. if `my_ip' is NULL, listen in any address. */ -int net_listen(const struct ip_addr *my_ip, unsigned int *port) +int net_listen(const struct ip_addr *my_ip, unsigned int *port, int backlog) { union sockaddr_union so; int ret, fd, opt = 1; @@ -281,7 +279,7 @@ *port = sin_get_port(&so); /* start listening */ - if (listen(fd, LISTEN_BACKLOG) >= 0) + if (listen(fd, backlog) >= 0) return fd; } @@ -292,7 +290,7 @@ return -1; } -int net_listen_unix(const char *path) +int net_listen_unix(const char *path, int backlog) { struct sockaddr_un sa; int fd; @@ -313,7 +311,7 @@ /* bind */ if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == 0) { /* start listening */ - if (listen(fd, LISTEN_BACKLOG) == 0) + if (listen(fd, backlog) == 0) return fd; }