VirtualBox

Changeset 107681 in vbox


Ignore:
Timestamp:
Jan 10, 2025 4:14:43 PM (8 days ago)
Author:
vboxsync
Message:

src/VBox/Main/src-client/GuestSessionImplTasks.cpp: Fixed warnings found by Parfait (unused assignment). Basically have rewritten GuestSessionTaskUpdateAdditions::waitForGuestSession(). jiraref:VBP-1424

File:
1 edited

Legend:

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

    r107674 r107681  
    28482848 * Newly created guest session needs to be closed by caller.
    28492849 *
    2850  * @returns 0 on success or VERR_TIMEOUT if guest services were not
    2851  *          started on time.
     2850 * @returns VBox status code.
     2851 * @retval  VERR_TIMEOUT if VBoxService on the guest was not started within time.
    28522852 * @param   pGuest          Guest interface to use.
    28532853 * @param   osType          Guest type.
     
    28572857                                                         ComObjPtr<GuestSession> &pNewSession)
    28582858{
    2859     int vrc                         = VERR_GSTCTL_GUEST_ERROR;
    2860     int vrcRet                      = VERR_TIMEOUT;
    2861 
    2862     uint64_t tsStart                = RTTimeSystemMilliTS();
    2863     const uint64_t cMsTimeout       = 10 * RT_MS_1MIN;
    2864 
    28652859    AssertReturn(!pGuest.isNull(), VERR_TIMEOUT);
    28662860
    2867     do
     2861    uint64_t const tsStart    = RTTimeSystemMilliTS();
     2862    uint64_t const cMsTimeout = 10 * RT_MS_1MIN; /** @todo r=andy Make this dynamic. */
     2863
     2864    int vrc;
     2865
     2866    for (;;)
    28682867    {
    28692868        GuestCredentials        guestCreds;
     2869
    28702870        GuestSessionStartupInfo startupInfo;
    2871 
    28722871        startupInfo.mName           = "Guest Additions connection check";
    28732872        startupInfo.mOpenTimeoutMS  = 100;
     
    28762875        if (RT_SUCCESS(vrc))
    28772876        {
    2878             Assert(!pNewSession.isNull());
    2879 
    2880             int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */
    2881             vrc = pNewSession->i_startSession(&vrcGuest);
     2877            vrc = pNewSession->i_startSession(NULL /* pvrcGuest */);
    28822878            if (RT_SUCCESS(vrc))
    28832879            {
    28842880                /* Wait for VBoxService to start. */
    28852881                GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None;
    2886                 int vrcGuest2 = VINF_SUCCESS; /* unused. */
    2887                 vrc = pNewSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2);
     2882                vrc = pNewSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult,
     2883                                             NULL /*pvrcGuest */);
    28882884                if (RT_SUCCESS(vrc))
    28892885                {
     
    28912887                    vrc = checkGuestAdditionsStatus(pNewSession, osType);
    28922888                    if (RT_SUCCESS(vrc))
    2893                         LogRel(("Guest Additions Update: Guest Additions were successfully reloaded after installation\n"));
     2889                        LogRel(("Guest Additions Update: Guest Additions were successfully reloaded after installation.\n"));
    28942890                    else
    2895                         LogRel(("Guest Additions Update: Guest Additions were failed to reload after installation, please consider rebooting the guest\n"));
    2896 
    2897                     vrcRet = VINF_SUCCESS;
     2891                        LogRel(("Guest Additions Update: Guest Additions failed to reload after installation, please consider rebooting the guest.\n"));
    28982892                    break;
    28992893                }
    29002894            }
    29012895
    2902             vrc = pNewSession->Close();
    2903         }
     2896            int vrc2 = pNewSession->Close();
     2897            if (RT_SUCCESS(vrc))
     2898                vrc = vrc2;
     2899        }
     2900
     2901        if ((RTTimeSystemMilliTS() - tsStart) >= cMsTimeout) /* Timeout? */
     2902        {
     2903            if (RT_SUCCESS(vrc)) /* Keep already set error. */
     2904                vrc = VERR_TIMEOUT;
     2905            break;
     2906        }
     2907        /* else retry */
    29042908
    29052909        RTThreadSleep(100);
    2906 
    2907     } while ((RTTimeSystemMilliTS() - tsStart) < cMsTimeout);
    2908 
    2909     return vrcRet;
     2910    } /* for */
     2911
     2912    if (RT_FAILURE(vrc))
     2913        LogRel(("Guest Additions Update: Waiting for guest session failed with %Rrc\n", vrc));
     2914
     2915    return vrc;
    29102916}
    29112917
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