[dovecot-cvs] dovecot/src/lib network.c, 1.25, 1.26 network.h, 1.12, 1.13

cras at dovecot.org cras at dovecot.org
Sun Jan 9 18:51:08 EET 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv30502/lib

Modified Files:
	network.c network.h 
Log Message:
Added backlog parameter for net_listen*().



Index: network.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- network.c	18 Sep 2004 14:37:18 -0000	1.25
+++ network.c	9 Jan 2005 16:51:06 -0000	1.26
@@ -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;
 	}
 

Index: network.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- network.h	13 Jun 2004 23:37:40 -0000	1.12
+++ network.h	9 Jan 2005 16:51:06 -0000	1.13
@@ -62,9 +62,9 @@
 void net_get_ip_any6(struct ip_addr *ip);
 
 /* Listen for connections on a socket */
-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);
 /* Listen for connections on an UNIX socket */
-int net_listen_unix(const char *path);
+int net_listen_unix(const char *path, int backlog);
 /* Accept a connection on a socket. Returns -1 for temporary failure,
    -2 for fatal failure */
 int net_accept(int fd, struct ip_addr *addr, unsigned int *port);



More information about the dovecot-cvs mailing list