VirtualBox

Changeset 73746 in vbox for trunk


Ignore:
Timestamp:
Aug 17, 2018 6:17:59 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124427
Message:

NAT/NATNet: Disable Nagle algorighm on the host using TCP_NODELAY (bugref:9226).

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/tcp_subr.c

    r72284 r73746  
    416416        opt = 1;
    417417        setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (char *)&opt, sizeof(opt));
     418        opt = 1;
     419        setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&opt, sizeof(opt));
    418420
    419421        ret = sobind(pData, so);
     
    551553    opt = 1;
    552554    setsockopt(s, SOL_SOCKET, SO_OOBINLINE,(char *)&opt, sizeof(int));
    553 #if 0
    554555    opt = 1;
    555556    setsockopt(s, IPPROTO_TCP, TCP_NODELAY,(char *)&opt, sizeof(int));
    556 #endif
    557557
    558558    optlen = sizeof(int);
  • trunk/src/VBox/NetworkServices/NAT/proxy.c

    r69500 r73746  
    359359    }
    360360#endif
     361
     362    /*
     363     * Disable the Nagle algorithm. Otherwise the host may hold back
     364     * packets that the guest wants to go out, causing potentially
     365     * horrible performance. The guest is already applying the Nagle
     366     * algorithm (or not) the way it wants.
     367     */
     368    if (stype == SOCK_STREAM) {
     369        int on = 1;
     370        const socklen_t onlen = sizeof(on);
     371
     372        status = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&on, onlen);
     373        if (status < 0) {
     374            DPRINTF(("TCP_NODELAY: %R[sockerr]\n", SOCKERRNO()));
     375            closesocket(s);
     376            return INVALID_SOCKET;
     377        }
     378    }
    361379
    362380#if defined(RT_OS_WINDOWS)
Note: See TracChangeset for help on using the changeset viewer.

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