]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make tcp_recv_bufsize apply to send buffers as well, in an attempt to control window...
authorhno <>
Fri, 24 Aug 2007 23:56:45 +0000 (23:56 +0000)
committerhno <>
Fri, 24 Aug 2007 23:56:45 +0000 (23:56 +0000)
the main reason to set tcp_recv_bufsize is to avoid problems related to large
windows. For example many firewalls still have problems with window scaling.

this change makes the option apply to send buffers as well, and also hints
Linux that Squid will never increase the buffer so the window scaling should
be clamped to the indicated buffer size.

src/comm.cc

index 134924e8837fdb77d2fc97a7ca15a42cca2e623c..11d98d7df65826bc452c33a2b2de0bb314286787 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.434 2007/08/11 12:13:26 serassio Exp $
+ * $Id: comm.cc,v 1.435 2007/08/24 17:56:45 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -1698,6 +1698,12 @@ commSetTcpRcvbuf(int fd, int size)
 {
     if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size)) < 0)
         debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE " << size << ": " << xstrerror());
+    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &size, sizeof(size)) < 0)
+        debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE " << size << ": " << xstrerror());
+#ifdef TCP_WINDOW_CLAMP
+    if (setsockopt(fd, SOL_TCP, TCP_WINDOW_CLAMP, (char *) &size, sizeof(size)) < 0)
+        debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE " << size << ": " << xstrerror());
+#endif
 }
 
 int