X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=comstack%2Ftcpip.c;h=b1f4f737562fd7b34912662916a7bc6e013bae3c;hp=8649a3f764ba4e12bd0cfd587a5d10760d83baeb;hb=6b3cf0738c53080781fedd852e26b299224af3c3;hpb=4d531a1a9131d69c3b6c27fbac42837e22cff61c diff --git a/comstack/tcpip.c b/comstack/tcpip.c index 8649a3f..b1f4f73 100644 --- a/comstack/tcpip.c +++ b/comstack/tcpip.c @@ -2,15 +2,18 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: tcpip.c,v 1.53 2003-01-06 08:20:27 adam Exp $ + * $Id: tcpip.c,v 1.55 2003-02-21 12:08:57 adam Exp $ */ #include #include #include -#ifndef WIN32 + +#ifdef WIN32 +#else #include #endif + #include #include #include @@ -22,9 +25,12 @@ #include #include #include +#include -/* Chas added the following, so we get the definition of completeBER */ -#include +#ifdef WIN32 +#else +#include +#endif static int tcpip_close(COMSTACK h); static int tcpip_put(COMSTACK h, char *buf, int size); @@ -176,7 +182,7 @@ COMSTACK tcpip_type(int s, int blocking, int protocol, void *vp) if (protocol == PROTO_WAIS) state->complete = completeWAIS; else - state->complete = completeBER; + state->complete = cs_complete_auto; p->timeout = COMSTACK_DEFAULT_TIMEOUT; TRC(fprintf(stderr, "Created new TCPIP comstack\n")); @@ -361,7 +367,9 @@ int tcpip_connect(COMSTACK h, void *address) */ int tcpip_rcvconnect(COMSTACK h) { +#if HAVE_OPENSSL_SSL_H tcpip_state *sp = (tcpip_state *)h->cprivate; +#endif TRC(fprintf(stderr, "tcpip_rcvconnect\n")); if (h->state == CS_ST_DATAXFER) @@ -408,7 +416,28 @@ int tcpip_rcvconnect(COMSTACK h) #define CERTF "ztest.pem" #define KEYF "ztest.pem" -int tcpip_bind(COMSTACK h, void *address, int mode) +static void tcpip_setsockopt (int fd) +{ +#if 0 + int len = 4096; + int set = 1; + + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { + yaz_log(LOG_WARN|LOG_ERRNO, "setsockopt TCP_NODELAY"); + } + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { + yaz_log(LOG_WARN|LOG_ERRNO, "setsockopt SNDBUF"); + } + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + yaz_log(LOG_WARN|LOG_ERRNO, "setsockopt RCVBUF"); + } +#endif +} + +static int tcpip_bind(COMSTACK h, void *address, int mode) { struct sockaddr *addr = (struct sockaddr *)address; #ifdef WIN32 @@ -462,6 +491,7 @@ int tcpip_bind(COMSTACK h, void *address, int mode) return -1; } #endif + tcpip_setsockopt(h->iofile); if (bind(h->iofile, addr, sizeof(struct sockaddr_in))) { h->cerrno = CSYSERR; @@ -527,6 +557,7 @@ int tcpip_listen(COMSTACK h, char *raddr, int *addrlen, return -1; } h->state = CS_ST_INCON; + tcpip_setsockopt (h->newfd); return 0; }