Why "tcp_recv_bufsize" also acts as "tcp_send_bufsize"?

From: Tianyin Xu <tixu_at_cs.ucsd.edu>
Date: Thu, 13 Dec 2012 00:45:50 -0800

Hi, Squid developers,

I'm using squid-3.1.19. I want to discuss the configuration directive
"tcp_recv_bufsize". I'm confused when seeing the code:

/* src/comm.cc */
1788 static void
1789 commSetTcpRcvbuf(int fd, int size)
1790 {
1791 if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &size,
sizeof(size)) < 0)
1792 debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE "
<< size << ": " << xstrerror());
1793 if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &size,
sizeof(size)) < 0)
1794 debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE "
<< size << ": " << xstrerror());
1795 #ifdef TCP_WINDOW_CLAMP
1796 if (setsockopt(fd, SOL_TCP, TCP_WINDOW_CLAMP, (char *) &size,
sizeof(size)) < 0)
1797 debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE "
<< size << ": " << xstrerror());
1798 #endif
1799 }

Accoding to the code, when setting "tcp_recv_bufsize", Squid also set
the same amount as tcp_send_bufsize? And the send log printing message
(line# 1794) seems problematic because the failure is caused by
setting "tcp_send_bufsize" (the flag is SO_SNDBUF). If we really want
to set the send buffer size, why not add another directive?

Thanks a lot!
Tianyin
Received on Thu Dec 13 2012 - 09:08:25 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 13 2012 - 12:00:11 MST