VirtualBox

Changeset 102680 in vbox


Ignore:
Timestamp:
Dec 21, 2023 4:20:51 PM (10 months ago)
Author:
vboxsync
Message:

Guest Control: Relaxed checks in IGuestSession::close() a bit, to make testcases pass again. Addendum to r160769.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r102654 r102680  
    39603960    LogFlowThisFuncEnter();
    39613961
    3962     HRESULT hrc = i_isStartedExternal();
    3963     if (FAILED(hrc))
    3964         return hrc;
    3965 
    39663962    int vrc = VINF_SUCCESS; /* Shut up MSVC. */
    39673963
    3968     /* If the guest session is not in an unsable state (anymore), do the cleanup stuff ourselves. */
     3964    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     3965
     3966    /* If the guest session is not in an usable state (anymore), do the cleanup stuff ourselves. */
    39693967    if (!i_isReady())
    39703968    {
     
    39733971    }
    39743972
    3975     /* Note: Don't check if the session is ready via i_isStartedExternal() here;
    3976      *       the session (already) could be in a stopped / aborted state. */
     3973    alock.release(); /* Leave lock before calling i_closeSession() below. */
    39773974
    39783975    int vrcGuest = VINF_SUCCESS;
    39793976
    3980     uint32_t msTimeout = RT_MS_10SEC; /* 10s timeout by default */
    3981     for (int i = 0; i < 3; i++)
    3982     {
    3983         if (i)
    3984         {
    3985             LogRel(("Guest Control: Closing session '%s' timed out (%RU32s timeout, attempt %d/10), retrying ...\n",
    3986                     mData.mSession.mName.c_str(), msTimeout / RT_MS_1SEC, i + 1));
    3987             msTimeout += RT_MS_5SEC; /* Slightly increase the timeout. */
    3988         }
    3989 
    3990         /* Close session on guest. */
    3991         vrc = i_closeSession(0 /* Flags */, msTimeout, &vrcGuest);
    3992         if (   RT_SUCCESS(vrc)
    3993             || vrc != VERR_TIMEOUT) /* If something else happened there is no point in retrying further. */
    3994             break;
     3977    /* If the session is in a started state, tell the guest to close it.
     3978     *
     3979     * Note: Don't check if the session is ready via i_isStartedExternal() here;
     3980     *       the session (already) could be in a stopped / aborted state.
     3981     */
     3982    AutoCaller autoCallerParent(mParent);
     3983    if (   SUCCEEDED(autoCallerParent.hrc())
     3984        && i_isStarted())
     3985    {
     3986        uint32_t msTimeout = RT_MS_10SEC; /* 10s timeout by default */
     3987        for (int i = 0; i < 3; i++)
     3988        {
     3989            if (i)
     3990            {
     3991                LogRel(("Guest Control: Closing session '%s' timed out (%RU32s timeout, attempt %d/10), retrying ...\n",
     3992                        mData.mSession.mName.c_str(), msTimeout / RT_MS_1SEC, i + 1));
     3993                msTimeout += RT_MS_5SEC; /* Slightly increase the timeout. */
     3994            }
     3995
     3996            /* Close session on guest. */
     3997            vrc = i_closeSession(0 /* Flags */, msTimeout, &vrcGuest);
     3998            if (   RT_SUCCESS(vrc)
     3999                || vrc != VERR_TIMEOUT) /* If something else happened there is no point in retrying further. */
     4000                break;
     4001        }
    39954002    }
    39964003
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