VirtualBox

Changeset 105897 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 29, 2024 7:18:56 AM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164617
Message:

Guest Control/VBoxService: Try a bit harder to become the guest control master in case there already is / was another master before (thus getting VERR_RESOURCE_BUSY from the host). Hopefully should help for some testcases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r102831 r105897  
    6666#include <iprt/path.h>
    6767#include <iprt/process.h>
     68#include <iprt/rand.h>
    6869#include <iprt/semaphore.h>
    6970#include <iprt/thread.h>
     
    246247    g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(g_idControlSvcClient);
    247248    if (g_fControlSupportsOptimizations)
    248         rc = VbglR3GuestCtrlMakeMeMaster(g_idControlSvcClient);
     249    {
     250        for (int i = 0; i < 3; i++)
     251        {
     252            rc = VbglR3GuestCtrlMakeMeMaster(g_idControlSvcClient);
     253            if (RT_SUCCESS(rc))
     254                break;
     255            RTThreadSleep(RTRandU32Ex(RT_MS_1SEC, RT_MS_5SEC));
     256            VGSvcError("Failed to become guest control master (#%d): %Rrc\n", i, rc);
     257        }
     258    }
    249259    if (RT_SUCCESS(rc))
    250260    {
     
    272282        return VINF_SUCCESS;
    273283    }
    274     VGSvcError("Failed to become guest control master: %Rrc\n", rc);
     284    VGSvcError("Giving up to become guest control master, disconnecting\n");
    275285    VbglR3GuestCtrlDisconnect(g_idControlSvcClient);
    276286
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