VirtualBox

Changeset 60086 in vbox for trunk


Ignore:
Timestamp:
Mar 17, 2016 9:22:32 PM (9 years ago)
Author:
vboxsync
Message:

NAT/Net: pxtcp_pmgr_pump - avoid unexpected POLLHUP spam on OS X.

File:
1 edited

Legend:

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

    r60080 r60086  
    17551755    if (revents & POLLHUP) {
    17561756        DPRINTF(("sock %d: HUP\n", fd));
     1757
    17571758#if HAVE_TCP_POLLHUP == POLLIN
     1759        /*
     1760         * XXX: OSX reports POLLHUP once more when inbound is already
     1761         * half-closed (which has already been reported as a "normal"
     1762         * POLLHUP, handled below), the socket is polled for POLLOUT
     1763         * (guest sends a lot of data that we can't push out fast
     1764         * enough), and remote sends a reset - e.g. an http client
     1765         * that half-closes after request and then aborts the transfer.
     1766         *
     1767         * It really should have been reported as POLLERR, but it
     1768         * seems OSX never reports POLLERR for sockets.
     1769         */
     1770#if defined(RT_OS_DARWIN)
     1771        {
     1772            socklen_t optlen = (socklen_t)sizeof(sockerr);
     1773
     1774            status = getsockopt(pxtcp->sock, SOL_SOCKET, SO_ERROR,
     1775                                (char *)&sockerr, &optlen);
     1776            if (status == SOCKET_ERROR) { /* should not happen */
     1777                DPRINTF(("sock %d: POLLHUP: SO_ERROR failed: %R[sockerr]\n",
     1778                         fd, SOCKERRNO()));
     1779                sockerr = ECONNRESET;
     1780            }
     1781            else if (sockerr != 0) {
     1782                DPRINTF0(("sock %d: POLLHUP: %R[sockerr]\n", fd, sockerr));
     1783            }
     1784
     1785            if (sockerr != 0) { /* XXX: should have been POLLERR */
     1786                return pxtcp_schedule_reset(pxtcp);
     1787            }
     1788        }
     1789#endif  /* RT_OS_DARWIN */
     1790
    17581791        /*
    17591792         * Remote closed inbound.
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