Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/nslcd.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2008-02-12 22:28:10 +0100
committerArthur de Jong <arthur@arthurdejong.org>2008-02-12 22:28:10 +0100
commitdbb142cc655e7115cff840faae39da9c854932d9 (patch)
tree5060fdac2231051bd2b24947b2c76e658a3c1949 /nslcd/nslcd.c
parent3e84a5fcf55c7f295ae95dcdaf5cdad11a4fdc91 (diff)
implement resizable I/O buffers and tune buffer sizes to normal requests
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@630 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/nslcd.c')
-rw-r--r--nslcd/nslcd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index 06dfff1..c61cd15 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -63,6 +63,12 @@
#include "compat/attrs.h"
#include "compat/getpeercred.h"
+/* buffer sizes for I/O */
+#define READBUFFER_MINSIZE 32
+#define READBUFFER_MAXSIZE 64
+#define WRITEBUFFER_MINSIZE 64
+#define WRITEBUFFER_MAXSIZE 64*1024
+
/* the definition of the environment */
extern char **environ;
@@ -345,7 +351,9 @@ static void handleconnection(int sock,MYLDAP_SESSION *session)
writetimeout.tv_sec=5; /* clients could be taking some time to process the results */
writetimeout.tv_usec=0;
/* create a stream object */
- if ((fp=tio_fdopen(sock,&readtimeout,&writetimeout))==NULL)
+ if ((fp=tio_fdopen(sock,&readtimeout,&writetimeout,
+ READBUFFER_MINSIZE,READBUFFER_MAXSIZE,
+ WRITEBUFFER_MINSIZE,WRITEBUFFER_MAXSIZE))==NULL)
{
log_log(LOG_WARNING,"cannot create stream for writing: %s",strerror(errno));
(void)close(sock);