From aaf5a12c13670c9d034ecf809448201e1ef5d8de Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 19 Jul 2005 12:40:52 +0000 Subject: [PATCH] Increase TCP/IP listener backlog from 3 (which I am guessing was copied from the SunOS manual entry way back when) so SOMAXCONN, so that the socket will queue as many incoming connections as it's able to handle ongoing connections. In other words, it will never now refuse a connection that it would be able to handle merely because it's not got around to accepting() enough of the pending connections yet. This is the behaviour anyway under Linux, where the listen() argument is ignored; but not under BSD and on systems such as MS-Windows that use BSD-derived TCP/IP stacks. The behaviour of YAZ-based servers should now be uniform across operating systems in this respect. --- src/tcpip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tcpip.c b/src/tcpip.c index db0e834..6400e7d 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tcpip.c,v 1.16 2005-06-25 15:46:06 adam Exp $ + * $Id: tcpip.c,v 1.17 2005-07-19 12:40:52 mike Exp $ */ /** * \file tcpip.c @@ -534,7 +534,8 @@ static int tcpip_bind(COMSTACK h, void *address, int mode) h->cerrno = CSYSERR; return -1; } - if (mode == CS_SERVER && listen(h->iofile, 3) < 0) + /* Allow a maximum-sized backlog of waiting-to-connect clients */ + if (mode == CS_SERVER && listen(h->iofile, SOMAXCONN) < 0) { h->cerrno = CSYSERR; return -1; -- 1.7.10.4