Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss/common.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 /nss/common.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 'nss/common.c')
-rw-r--r--nss/common.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nss/common.c b/nss/common.c
index 00aebf2..4466f1a 100644
--- a/nss/common.c
+++ b/nss/common.c
@@ -39,6 +39,12 @@
#include "common.h"
#include "common/tio.h"
+/* buffer sizes for I/O */
+#define READBUFFER_MINSIZE 1024
+#define READBUFFER_MAXSIZE 32*1024
+#define WRITEBUFFER_MINSIZE 32
+#define WRITEBUFFER_MAXSIZE 32
+
/* returns a socket to the server or NULL on error (see errno),
socket should be closed with fclose() */
TFILE *nslcd_client_open()
@@ -67,7 +73,9 @@ TFILE *nslcd_client_open()
writetimeout.tv_sec=1; /* nslcd could be loaded with requests */
writetimeout.tv_usec=500000;
/* 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)
{
(void)close(sock);
return NULL;