diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-06-30 10:36:40 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-06-30 10:36:40 +0000 |
commit | 4a83803381f3ce1838f5650e7096d9006f673fdd (patch) | |
tree | 90132897a2d186a4cf83d214d319bfc2476ed8ee | |
parent | 9adef9ffefbf7f7fc25274bc2774f81c65e72444 (diff) | |
download | cygnal-4a83803381f3ce1838f5650e7096d9006f673fdd.tar.gz cygnal-4a83803381f3ce1838f5650e7096d9006f673fdd.tar.bz2 cygnal-4a83803381f3ce1838f5650e7096d9006f673fdd.zip |
* net.cc (fdsock): Set default socket buffer sizes to 65520. Change
comment accordingly.
* fhandler_socket.cc (fhandler_socket::send_internal): Set maximum
send size to 65520 as well.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 21 |
3 files changed, 18 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b1b0dde60..0f9faeaa3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2009-06-30 Corinna Vinschen <corinna@vinschen.de> + + * net.cc (fdsock): Set default socket buffer sizes to 65520. Change + comment accordingly. + * fhandler_socket.cc (fhandler_socket::send_internal): Set maximum + send size to 65520 as well. + 2009-06-29 Christopher Faylor <me+cygwin@cgf.cx> * select.cc (peek_pipe): Turn on (temporarily?) the experimental code diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index d2e4ac286..17900fdfe 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1489,8 +1489,8 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags) { buf.buf = wsamsg->lpBuffers[i].buf + off; buf.len = wsamsg->lpBuffers[i].len - off; - if (buf.len > 65536) /* See KB 823764 */ - buf.len = 65536; + if (buf.len > 65520) /* See net.cc:fdsock() and MSDN KB 823764 */ + buf.len = 65520; do { diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index b6ec47744..bf982b317 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -492,26 +492,23 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) fd->set_flags (O_RDWR | O_BINARY); fd->uninterruptible_io (true); debug_printf ("fd %d, name '%s', soc %p", (int) fd, dev->name, soc); -#if 0 - /* Same default buffer sizes as on Linux (instead of WinSock default 8K). - NOT. If the SO_RCVBUF size exceeds 65535(*), and if the socket is - connected to a remote machine, then duplicating the socket on - fork/exec fails with WinSock error 10022, WSAEINVAL. Given that, - there's not any good reason to set the buffer sizes at all. So we - stick with the defaults. However, an explanation for this weird - behaviour would be nice. I keep this stuff in the code for later - generations. Archeological programmers might find it useful. + /* Raise default buffer sizes (instead of WinSock default 8K). + + NOTE. If the SO_RCVBUF size exceeds 65535(*), and if the socket is + connected to a remote machine, then duplicating the socket on fork/exec + fails with WinSock error 10022, WSAEINVAL. An explanation for this + weird behaviour would be nice. (*) Maximum normal TCP window size. Coincidence? */ - int rmem = dev == tcp_dev ? 87380 : 120832; - int wmem = dev == tcp_dev ? 16384 : 120832; + int rmem = 65520; + int wmem = 65520; if (::setsockopt (soc, SOL_SOCKET, SO_RCVBUF, (char *) &rmem, sizeof (int))) debug_printf ("setsockopt(SO_RCVBUF) failed, %lu", WSAGetLastError ()); if (::setsockopt (soc, SOL_SOCKET, SO_SNDBUF, (char *) &wmem, sizeof (int))) debug_printf ("setsockopt(SO_SNDBUF) failed, %lu", WSAGetLastError ()); -#endif + return true; } |