VirtualBox

Changeset 42485 in vbox


Ignore:
Timestamp:
Jul 31, 2012 4:13:53 PM (12 years ago)
Author:
vboxsync
Message:

Guest Control 2.0: Update.

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r42478 r42485  
    3737#endif
    3838
     39#ifdef LOG_GROUP
     40 #undef LOG_GROUP
     41#endif
    3942#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
    4043#include <VBox/log.h>
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r42461 r42485  
    140140    struct Data
    141141    {
    142         /** Guest control protocol version.
    143          *  Guest control prior to VBox 4.2 has version 1,
    144          *  guest control 2.0 has ...well, 2. */
     142        /** Guest control protocol version to be used.
     143         *  Guest Additions < VBox 4.2 have version 1,
     144         *  any newer version will have version 2. */
    145145        uint32_t             mProtocolVersion;
    146146        /** Flag indicating if this is an internal session
     
    157157        /** The session timeout. Default is 30s. */
    158158        ULONG                mTimeout;
     159        /** The next process ID for assignment. */
     160        ULONG                mNextProcessID;
     161        /** The session's environment block. Can be
     162         *  overwritten/extended by ProcessCreate(Ex). */
    159163        GuestEnvironment     mEnvironment;
     164        /** Directory objects bound to this session. */
    160165        SessionDirectories   mDirectories;
     166        /** File objects bound to this session. */
    161167        SessionFiles         mFiles;
     168        /** Process objects bound to this session. */
    162169        SessionProcesses     mProcesses;
    163170    } mData;
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r42478 r42485  
    150150    Assert((pvData == NULL) && !cbData);
    151151
    152     int rc = VINF_SUCCESS;
    153152    switch (enmType)
    154153    {
     
    185184    }
    186185
     186    int rc = GuestCtrlEvent::Init();
    187187    if (RT_SUCCESS(rc))
    188     {
    189         rc = GuestCtrlEvent::Init();
    190         if (RT_SUCCESS(rc))
    191             mType  = enmType;
    192     }
     188        mType  = enmType;
    193189
    194190    LogFlowFuncLeaveRC(rc);
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r42478 r42485  
    318318    /* Create a new context ID and assign it. */
    319319    int rc = VERR_NOT_FOUND;
     320
     321    ULONG uCount = mData.mNextContextID++;
    320322    ULONG uNewContextID = 0;
    321323    ULONG uTries = 0;
    322324    for (;;)
    323325    {
     326        if (uCount == VBOX_GUESTCTRL_MAX_CONTEXTS)
     327            uCount = 0;
     328
    324329        /* Create a new context ID ... */
    325330        uNewContextID = VBOX_GUESTCTRL_CONTEXTID_MAKE(uSessionID,
    326                                                       mData.mProcessID, mData.mNextContextID);
    327         if (mData.mNextContextID == VBOX_GUESTCTRL_MAX_CONTEXTS)
    328             mData.mNextContextID = 0;
     331                                                      mData.mProcessID, uCount);
     332
    329333        /* Is the context ID already used?  Try next ID ... */
    330         if (!callbackExists(uNewContextID))
     334        if (!callbackExists(uCount))
    331335        {
    332336            /* Callback with context ID was not found. This means
     
    336340            break;
    337341        }
    338         mData.mNextContextID++;
    339 
     342
     343        uCount++;
    340344        if (++uTries == UINT32_MAX)
    341345            break; /* Don't try too hard. */
     
    348352         *       the session + process ID), just the context count
    349353         *       will be used here. */
    350         mData.mCallbacks[mData.mNextContextID] = pCallback;
     354        mData.mCallbacks[uCount] = pCallback;
    351355        Assert(mData.mCallbacks.size());
    352356
     
    356360
    357361        LogFlowThisFunc(("Added new callback (Session: %RU32, Process: %RU32, Count=%RU32) CID=%RU32\n",
    358                      uSessionID, mData.mProcessID, mData.mNextContextID, uNewContextID));
     362                     uSessionID, mData.mProcessID, uCount, uNewContextID));
    359363    }
    360364
     
    784788    {
    785789        if (pData->pvData && pData->cbData)
     790        {
    786791            rc = pCallback->FillData(pData->pvData, pData->cbData);
     792            Assert(pCallback->GetPayloadSize() == pData->cbData);
     793        }
    787794
    788795        int rc2 = pCallback->Signal();
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r42478 r42485  
    7676    mData.mName = aName;
    7777
     78    mData.mNextProcessID = 0;
     79
    7880    /* Confirm a successful initialization when it's the case. */
    7981    autoInitSpan.setSucceeded();
     
    482484
    483485    /* Create a new (host-based) process ID and assign it. */
    484     ULONG uNewProcessID = 0;
    485486    ULONG uTries = 0;
    486487
     
    488489    {
    489490        /* Is the context ID already used? */
    490         if (!processExists(uNewProcessID, NULL /* pProgress */))
     491        if (!processExists(mData.mNextProcessID, NULL /* pProgress */))
    491492        {
    492493            /* Callback with context ID was not found. This means
     
    496497            break;
    497498        }
    498         uNewProcessID++;
     499        mData.mNextProcessID++;
     500        if (mData.mNextProcessID == UINT32_MAX)
     501            mData.mNextProcessID = 0;
    499502
    500503        if (++uTries == UINT32_MAX)
     
    510513
    511514        rc = pProcess->init(mData.mParent->getConsole() /* Console */, this /* Session */,
    512                             uNewProcessID, procInfo);
     515                            mData.mNextProcessID, procInfo);
    513516        if (RT_FAILURE(rc)) throw rc;
    514517
    515518        /* Add the created process to our map. */
    516         mData.mProcesses[uNewProcessID] = pProcess;
     519        mData.mProcesses[mData.mNextProcessID] = pProcess;
    517520
    518521        LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32\n",
    519                      mData.mId, uNewProcessID));
     522                     mData.mId, mData.mNextProcessID));
    520523    }
    521524    catch (int rc2)
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