VirtualBox

Ignore:
Timestamp:
Apr 27, 2016 8:02:31 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106897
Message:

Main/USBProxyBackendUsbIp.cpp: Fixes for Windows, RTPoll returns with both the read and error events set so we have to check for available data first before handling the error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/generic/USBProxyBackendUsbIp.cpp

    r60551 r60713  
    412412    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
    413413    devLock.release();
    414     interruptWait();
    415414
    416415    return VINF_SUCCESS;
     
    431430    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
    432431    devLock.release();
    433     interruptWait();
    434432
    435433    return VINF_SUCCESS;
     
    504502            else if (uIdReady == USBIP_POLL_ID_SOCKET)
    505503            {
    506                 if (fEventsRecv & RTPOLL_EVT_ERROR)
     504                if (fEventsRecv & RTPOLL_EVT_READ)
     505                    rc = receiveData();
     506                else if (fEventsRecv & RTPOLL_EVT_ERROR)
    507507                    rc = VERR_NET_SHUTDOWN;
    508                 else
    509                     rc = receiveData();
     508
    510509                if (RT_SUCCESS(rc))
    511510                {
     
    788787int USBProxyBackendUsbIp::receiveData()
    789788{
     789    int rc = VINF_SUCCESS;
    790790    size_t cbRecvd = 0;
    791     int rc = RTTcpReadNB(m->hSocket, m->pbRecvBuf, m->cbResidualRecv, &cbRecvd);
    792     if (RT_SUCCESS(rc))
    793     {
    794         m->cbResidualRecv -= cbRecvd;
    795         m->pbRecvBuf      += cbRecvd;
    796         /* In case we received everything for the current state process the data. */
    797         if (!m->cbResidualRecv)
    798             rc = processData();
    799     }
     791
     792    do
     793    {
     794        rc = RTTcpReadNB(m->hSocket, m->pbRecvBuf, m->cbResidualRecv, &cbRecvd);
     795        if (RT_SUCCESS(rc))
     796        {
     797            m->cbResidualRecv -= cbRecvd;
     798            m->pbRecvBuf      += cbRecvd;
     799            /* In case we received everything for the current state process the data. */
     800            if (!m->cbResidualRecv)
     801            {
     802                rc = processData();
     803                if (   RT_SUCCESS(rc)
     804                    && m->enmRecvState == kUsbIpRecvState_None)
     805                    break;
     806            }
     807        }
     808    } while (RT_SUCCESS(rc) && cbRecvd > 0);
    800809
    801810    return rc;
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