X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jbsockets.c;h=6f66e1ced353afd0e1dbd8048ca8659c640b051b;hp=2fe622b430d878e37c2a451bcef0d33b802310e0;hb=60b84734caeb5cc110a3d0ec27351f33f5044dc0;hpb=01a42dd85e9c8debe6a03e532a7335ccb4bdafdf diff --git a/jbsockets.c b/jbsockets.c index 2fe622b4..6f66e1ce 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.43 2007/06/01 18:16:36 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.44 2007/09/15 13:01:31 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -35,6 +35,11 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.43 2007/06/01 18:16:36 fabian * * Revisions : * $Log: jbsockets.c,v $ + * Revision 1.44 2007/09/15 13:01:31 fabiankeil + * Increase listen() backlog to SOMAXCONN (or 128) to decrease + * chances of dropped connections under load. Problem reported + * and fix suggested by nobody in BR#1795281. + * * Revision 1.43 2007/06/01 18:16:36 fabiankeil * Use the same mutex for gethostbyname() and gethostbyaddr() to prevent * deadlocks and crashes on OpenBSD and possibly other OS with neither @@ -306,10 +311,8 @@ const char jbsockets_h_rcs[] = JBSOCKETS_H_VERSION; */ #define MAX_DNS_RETRIES 10 -#ifndef SOMAXCONN -/* XXX: Might not be necessary. */ -#define SOMAXCONN 128 -#endif +#define MAX_LISTEN_BACKLOG 128 + /********************************************************************* * @@ -687,7 +690,7 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd) } } - while (listen(fd, SOMAXCONN) == -1) + while (listen(fd, MAX_LISTEN_BACKLOG) == -1) { if (errno != EINTR) {