VirtualBox

Changeset 54900 in vbox


Ignore:
Timestamp:
Mar 23, 2015 3:35:41 AM (10 years ago)
Author:
vboxsync
Message:

NAT/Network: proxy_create_socket - bump up SNDBUF for TCP sockets Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/proxy.c

    r54895 r54900  
    358358            closesocket(s);
    359359            return INVALID_SOCKET;
     360        }
     361    }
     362#endif
     363
     364#if defined(RT_OS_WINDOWS)
     365    /*
     366     * lwIP only holds one packet of "refused data" for us.  Proxy
     367     * relies on OS socket send buffer and doesn't do its own
     368     * buffering.  Unfortunately on Windows send buffer is very small
     369     * (8K by default) and is not dynamically adpated by the OS it
     370     * seems.  So a single large write will fill it up and that will
     371     * make lwIP drop segments, causing guest TCP into pathologic
     372     * resend patterns.  As a quick and dirty fix just bump it up.
     373     */
     374    if (stype == SOCK_STREAM) {
     375        int sndbuf;
     376        socklen_t optlen = sizeof(sndbuf);
     377
     378        status = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sndbuf, &optlen);
     379        if (status == 0) {
     380            if (sndbuf < 64 * 1024) {
     381                sndbuf = 64 * 1024;
     382                status = setsockopt(s, SOL_SOCKET, SO_SNDBUF,
     383                                    (char *)&sndbuf, optlen);
     384                if (status != 0) {
     385                    DPRINTF(("SO_SNDBUF: setsockopt: %R[sockerr]\n", SOCKERRNO()));
     386                }
     387            }
     388        }
     389        else {
     390            DPRINTF(("SO_SNDBUF: getsockopt: %R[sockerr]\n", SOCKERRNO()));
    360391        }
    361392    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette