VirtualBox

Changeset 58292 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 17, 2015 10:04:46 PM (9 years ago)
Author:
vboxsync
Message:

localipc-posix.cpp: VERR_BROKEN_PIPE fixes for RTLocalIpcSessionRead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/localipc-posix.cpp

    r58290 r58292  
    640640
    641641
    642 #if 0 /* maybe later */
    643642/**
    644643 * Checks if the socket has has a HUP condition.
     
    649648static bool rtLocalIpcPosixHasHup(PRTLOCALIPCSESSIONINT pThis)
    650649{
    651 # ifndef RT_OS_OS2
     650#ifndef RT_OS_OS2
    652651    struct pollfd PollFd;
    653652    RT_ZERO(PollFd);
     
    657656       && (PollFd.revents & POLLHUP);
    658657
    659 # else /* RT_OS_OS2: */
    660     return false;
    661 # endif
    662 }
     658#else /* RT_OS_OS2: */
     659    return true;
    663660#endif
     661}
    664662
    665663
     
    693691
    694692                    rc = RTSocketRead(pThis->hSocket, pvBuffer, cbBuffer, pcbRead);
     693
     694                    /* Detect broken pipe. */
     695                    if (rc == VINF_SUCCESS)
     696                    {
     697                        if (!pcbRead || *pcbRead)
     698                        { /* likely */ }
     699                        else if (rtLocalIpcPosixHasHup(pThis))
     700                            rc = VERR_BROKEN_PIPE;
     701                    }
     702                    else if (rc == VERR_NET_CONNECTION_RESET_BY_PEER || rc == VERR_NET_SHUTDOWN)
     703                        rc = VERR_BROKEN_PIPE;
    695704
    696705                    int rc2 = RTCritSectEnter(&pThis->CritSect);
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