VirtualBox

Changeset 58371 in vbox


Ignore:
Timestamp:
Oct 22, 2015 10:40:49 AM (9 years ago)
Author:
vboxsync
Message:

DnD/VbglR3: Detect and handle VM session changes and do a reconnect if necessary.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestLib.h

    r58212 r58371  
    758758     *        Use a union for the HGCM stuff then. */
    759759
    760     /** IN:  HGCM client ID to use for communication. */
     760    /** HGCM client ID to use for communication. */
    761761    uint32_t uClientID;
    762     /** IN:  Protocol version to use. */
     762    /** The VM's current session ID. */
     763    uint64_t uSessionID;
     764    /** Protocol version to use. */
    763765    uint32_t uProtocol;
    764     /** OUT: Number of parameters retrieved. */
     766    /** Number of parameters retrieved for the current command. */
    765767    uint32_t uNumParms;
    766     /** IN:  Max chunk size (in bytes) for data transfers. */
     768    /** Max chunk size (in bytes) for data transfers. */
    767769    uint32_t cbMaxChunkSize;
    768770} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp

    r58370 r58371  
    13611361
    13621362    /*
     1363     * Get the VM's session ID.
     1364     * This is not fatal in case we're running with an ancient VBox version.
     1365     */
     1366    pCtx->uSessionID = 0;
     1367    int rc2 = VbglR3GetSessionId(&pCtx->uSessionID);
     1368    LogFlowFunc(("uSessionID=%RU64, rc=%Rrc\n", pCtx->uSessionID, rc2));
     1369
     1370    /*
    13631371     * Check if the host is >= VBox 5.0 which in case supports GUEST_DND_CONNECT.
    13641372     */
     
    13681376        /* The guest property service might not be available. Not fatal. */
    13691377        uint32_t uGuestPropSvcClientID;
    1370         int rc2 = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
     1378        rc2 = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
    13711379        if (RT_SUCCESS(rc2))
    13721380        {
     
    14171425        }
    14181426
    1419         int rc2 = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     1427        rc2 = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    14201428        if (RT_SUCCESS(rc2))
    14211429            rc2 = Msg.hdr.result; /* Not fatal. */
     
    14641472
    14651473    int rc = vbglR3DnDGetNextMsgType(pCtx, &uMsg, &uNumParms, true /* fWait */);
     1474    if (RT_SUCCESS(rc))
     1475    {
     1476        /* Check for VM session change. */
     1477        uint64_t uSessionID;
     1478        int rc2 = VbglR3GetSessionId(&uSessionID);
     1479        if (   RT_SUCCESS(rc2)
     1480            && (uSessionID != pCtx->uSessionID))
     1481        {
     1482            LogFlowFunc(("VM session ID changed to %RU64, doing reconnect\n", uSessionID));
     1483
     1484            /* Try a reconnect to the DnD service. */
     1485            rc2 = VbglR3DnDDisconnect(pCtx);
     1486            AssertRC(rc2);
     1487            rc2 = VbglR3DnDConnect(pCtx);
     1488            AssertRC(rc2);
     1489
     1490            /* At this point we continue processing the messsages with the new client ID. */
     1491        }
     1492    }
     1493
    14661494    if (RT_SUCCESS(rc))
    14671495    {
     
    15591587    }
    15601588
     1589    if (RT_FAILURE(rc))
     1590        LogFlowFunc(("Returning error %Rrc\n", rc));
    15611591    return rc;
    15621592}
     
    20682098        if (strRootDest.isNotEmpty())
    20692099        {
    2070             void    *pvURIList = (void *)strRootDest.c_str();        /* URI root list. */
     2100            void *pvURIList  = (void *)strRootDest.c_str(); /* URI root list. */
    20712101            uint32_t cbURLIist = (uint32_t)strRootDest.length() + 1; /* Include string termination. */
    20722102
     
    21692199        rc = Msg.hdr.result;
    21702200
    2171     LogFlowFunc(("Sending error %Rrc returned with rc=%Rrc\n", rcErr, rc));
     2201    if (RT_FAILURE(rc))
     2202        LogFlowFunc(("Sending error %Rrc failed with rc=%Rrc\n", rcErr, rc));
    21722203    return rc;
    21732204}
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