From: wessels <> Date: Thu, 25 Jul 1996 11:45:46 +0000 (+0000) Subject: Added commSetTcpRcvbuf() X-Git-Tag: SQUID_3_0_PRE1~5998 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f868539a5314c48bcebe388f905bf6ddf6ad27a8;p=thirdparty%2Fsquid.git Added commSetTcpRcvbuf() --- diff --git a/src/comm.cc b/src/comm.cc index fd2786641b..6b0a32cf54 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,7 +1,7 @@ /* - * $Id: comm.cc,v 1.45 1996/07/23 04:11:03 wessels Exp $ + * $Id: comm.cc,v 1.46 1996/07/25 05:45:46 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -150,6 +150,7 @@ static void RWStateCallbackAndFree _PARAMS((int fd, RWStateData *, int code)); #ifdef TCP_NODELAY static void commSetTcpNoDelay _PARAMS((int)); #endif +static void commSetTcpRcvbuf _PARAMS((int, int)); static int *fd_lifetime = NULL; static struct timeval zero_tv; @@ -234,6 +235,7 @@ int comm_open(io_type, addr, port, note) int new_socket; FD_ENTRY *conn = NULL; int sock_type = io_type & COMM_DGRAM ? SOCK_DGRAM : SOCK_STREAM; + int tcp_rcv_bufsz = getTcpRcvBufsz(); /* Create socket for accepting new connections. */ if ((new_socket = socket(AF_INET, sock_type, 0)) < 0) { @@ -283,6 +285,8 @@ int comm_open(io_type, addr, port, note) if (sock_type == SOCK_STREAM) commSetTcpNoDelay(new_socket); #endif + if (tcp_rcv_bufsz > 0 && sock_type == SOCK_STREAM) + commSetTcpRcvbuf(new_socket, tcp_rcv_bufsz); conn->comm_type = io_type; return new_socket; } @@ -958,6 +962,16 @@ static void commSetTcpNoDelay(fd) } #endif +static void commSetTcpRcvbuf(fd, size) + int fd; + int size; +{ + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size)) < 0) + debug(5, 1, "commSetTcpRcvbuf: FD %d, SIZE %d: %s\n", + fd, size, xstrerror()); +} + + int commSetNonBlocking(fd) int fd; {