VirtualBox

Changeset 43697 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Oct 22, 2012 3:03:03 PM (12 years ago)
Author:
vboxsync
Message:

GuestProperties: complete a notification request if the client submits exactly the same request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestProperties/service.cpp

    r40767 r43697  
    134134struct GuestCall
    135135{
     136    uint32_t u32ClientId;
    136137    /** The call handle */
    137138    VBOXHGCMCALLHANDLE mHandle;
     
    144145
    145146    /** The standard constructor */
    146     GuestCall() : mFunction(0) {}
     147    GuestCall() : u32ClientId(0), mFunction(0) {}
    147148    /** The normal constructor */
    148     GuestCall(VBOXHGCMCALLHANDLE aHandle, uint32_t aFunction,
     149    GuestCall(uint32_t aClientId, VBOXHGCMCALLHANDLE aHandle, uint32_t aFunction,
    149150              VBOXHGCMSVCPARM aParms[], int aRc)
    150               : mHandle(aHandle), mFunction(aFunction), mParms(aParms),
     151              : u32ClientId(aClientId), mHandle(aHandle), mFunction(aFunction), mParms(aParms),
    151152                mRc(aRc) {}
    152153};
     
    371372    int delProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool isGuest);
    372373    int enumProps(uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    373     int getNotification(VBOXHGCMCALLHANDLE callHandle, uint32_t cParms,
     374    int getNotification(uint32_t u32ClientId, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms,
    374375                        VBOXHGCMSVCPARM paParms[]);
    375376    int getOldNotificationInternal(const char *pszPattern,
     
    10141015 * @throws  can throw std::bad_alloc
    10151016 */
    1016 int Service::getNotification(VBOXHGCMCALLHANDLE callHandle, uint32_t cParms,
     1017int Service::getNotification(uint32_t u32ClientId, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms,
    10171018                             VBOXHGCMSVCPARM paParms[])
    10181019{
     
    10471048    if (RT_SUCCESS(rc) && prop.isNull())
    10481049    {
    1049         mGuestWaiters.push_back(GuestCall(callHandle, GET_NOTIFICATION,
     1050        /*
     1051         * Check if the client already had the same request.
     1052         * Complete the old request with an error in this case.
     1053         * Protection against clients, which cancel and resubmits requests.
     1054         */
     1055        CallList::iterator it = mGuestWaiters.begin();
     1056        while (it != mGuestWaiters.end())
     1057        {
     1058            const char *pszPatternsExisting;
     1059            uint32_t cchPatternsExisting;
     1060            int rc3 = it->mParms[0].getString(&pszPatternsExisting, &cchPatternsExisting);
     1061
     1062            if (   RT_SUCCESS(rc3)
     1063                && u32ClientId == it->u32ClientId
     1064                && RTStrCmp(pszPatterns, pszPatternsExisting) == 0)
     1065            {
     1066                /* Complete the old request. */
     1067                mpHelpers->pfnCallComplete(it->mHandle, VERR_INTERRUPTED);
     1068                it = mGuestWaiters.erase(it);
     1069            }
     1070            else
     1071                ++it;
     1072        }
     1073
     1074        mGuestWaiters.push_back(GuestCall(u32ClientId, callHandle, GET_NOTIFICATION,
    10501075                                          paParms, rc));
    10511076        rc = VINF_HGCM_ASYNC_EXECUTE;
     
    12381263            case GET_NOTIFICATION:
    12391264                LogFlowFunc(("GET_NOTIFICATION\n"));
    1240                 rc = getNotification(callHandle, cParms, paParms);
     1265                rc = getNotification(u32ClientID, callHandle, cParms, paParms);
    12411266                break;
    12421267
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