VirtualBox

Changeset 43927 in vbox


Ignore:
Timestamp:
Nov 21, 2012 10:29:18 AM (12 years ago)
Author:
vboxsync
Message:

Forward ported r81841 + r82127 (VBoxHeadless/VBoxService: Enhanced (release flow) logging for user disconnect handling, more flow logging).

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r43793 r43927  
    262262
    263263#if defined(VBOX_WITH_DBUS) && defined(RT_OS_LINUX) /* Not yet for Solaris/FreeBSB. */
    264 /* 
     264/*
    265265 * Simple wrapper to work around compiler-specific va_list madness.
    266266 */
     
    388388                char **ppszSessions; int cSessions;
    389389                if (   (dbus_message_get_type(pMsgSessions) == DBUS_MESSAGE_TYPE_METHOD_CALL)
    390                     && vboxService_dbus_message_get_args(pReplySessions, &dbErr, DBUS_TYPE_ARRAY, 
    391                                                          DBUS_TYPE_OBJECT_PATH, &ppszSessions, &cSessions, 
     390                    && vboxService_dbus_message_get_args(pReplySessions, &dbErr, DBUS_TYPE_ARRAY,
     391                                                         DBUS_TYPE_OBJECT_PATH, &ppszSessions, &cSessions,
    392392                                                         DBUS_TYPE_INVALID /* Termination */))
    393393                {
     
    429429                                        && ppwEntry->pw_name)
    430430                                    {
    431                                         VBoxServiceVerbose(4, "ConsoleKit: session '%s' -> %s (uid: %RU32)\n", 
     431                                        VBoxServiceVerbose(4, "ConsoleKit: session '%s' -> %s (uid: %RU32)\n",
    432432                                                           *ppszCurSession, ppwEntry->pw_name, uid);
    433433
     
    471471                {
    472472                    VBoxServiceError("ConsoleKit: unable to retrieve session parameters (msg type=%d): %s",
    473                                      dbus_message_get_type(pMsgSessions), 
     473                                     dbus_message_get_type(pMsgSessions),
    474474                                     dbus_error_is_set(&dbErr) ? dbErr.message : "No error information available\n");
    475475                }
     
    566566
    567567    if (pszUserList && cUsersInList > 0)
    568         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", "%s", pszUserList);
     568        rc = VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", "%s", pszUserList);
    569569    else
    570         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
    571     VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsers", "%u", cUsersInList);
     570        rc = VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
     571    if (RT_FAILURE(rc))
     572    {
     573        VBoxServiceError("VMInfo: Error writing logged on users list, rc=%Rrc\n", rc);
     574        cUsersInList = 0; /* Reset user count on error. */
     575    }
     576
     577    rc = VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsers", "%u", cUsersInList);
     578    if (RT_FAILURE(rc))
     579    {
     580        VBoxServiceError("VMInfo: Error writing logged on users count, rc=%Rrc\n", rc);
     581        cUsersInList = 0; /* Reset user count on error. */
     582    }
     583
    572584    if (g_cVMInfoLoggedInUsers != cUsersInList)
    573585    {
    574         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers",
    575                                    cUsersInList == 0 ? "true" : "false");
     586        rc = VBoxServicePropCacheUpdate(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers",
     587                                        cUsersInList == 0 ? "true" : "false");
     588        if (RT_FAILURE(rc))
     589            VBoxServiceError("VMInfo: Error writing no logged in users beacon, rc=%Rrc\n", rc);
    576590        g_cVMInfoLoggedInUsers = cUsersInList;
    577591    }
    578 
    579     if (RT_SUCCESS(rc) && pszUserList)
     592    if (pszUserList)
    580593        RTStrFree(pszUserList);
    581594    return rc;
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r42476 r43927  
    168168                Assert(gpcev);
    169169
    170                 Bstr aKey;
    171                 gpcev->COMGETTER(Name)(aKey.asOutParam());
    172 
    173                 if (aKey == Bstr("/VirtualBox/GuestInfo/OS/NoLoggedInUsers"))
     170                Bstr strKey;
     171                gpcev->COMGETTER(Name)(strKey.asOutParam());
     172
     173                Utf8Str utf8Key = strKey;
     174                LogRelFlow(("Guest property \"%s\" has been changed\n", utf8Key.c_str()));
     175
     176                if (utf8Key.equals("/VirtualBox/GuestInfo/OS/NoLoggedInUsers"))
    174177                {
     178                    LogRelFlow(("Guest indicates that there %s logged in users (anymore)\n",
     179                                utf8Key.equals("true") ? "are no" : "are"));
     180
    175181                    /* Check if this is our machine and the "disconnect on logout feature" is enabled. */
    176182                    BOOL fProcessDisconnectOnGuestLogout = FALSE;
     
    188194                            if (id == machineId)
    189195                            {
    190                                 Bstr value1;
     196                                Bstr strDiscon;
    191197                                hrc = machine->GetExtraData(Bstr("VRDP/DisconnectOnGuestLogout").raw(),
    192                                                             value1.asOutParam());
    193                                 if (SUCCEEDED(hrc) && value1 == "1")
     198                                                            strDiscon.asOutParam());
     199                                if (SUCCEEDED(hrc))
    194200                                {
    195                                     fProcessDisconnectOnGuestLogout = TRUE;
     201                                    Utf8Str utf8Discon = strDiscon;
     202                                    fProcessDisconnectOnGuestLogout = utf8Discon.equals("1")
     203                                                                    ? TRUE : FALSE;
     204
     205                                    LogRelFlow(("VRDE: ExtraData VRDP/DisconnectOnGuestLogout=%s\n",
     206                                                utf8Discon.c_str()));
    196207                                }
    197208                            }
    198209                        }
    199210                    }
     211                    else
     212                        LogRel(("VRDE: No console available, skipping disconnect on guest logout check\n"));
     213
     214                    LogRelFlow(("VRDE: hrc=%Rhrc: Host %s disconnecting clients (current host state known: %s)\n",
     215                                hrc, fProcessDisconnectOnGuestLogout ? "will handle" : "does not handle",
     216                                mfNoLoggedInUsers ? "No users logged in" : "Users logged in"));
    200217
    201218                    if (fProcessDisconnectOnGuestLogout)
     
    226243                            fDropConnection = true;
    227244
     245                        LogRelFlow(("VRDE: szNoLoggedInUsers=%s, mfNoLoggedInUsers=%RTbool, fDropConnection=%RTbool\n",
     246                                    utf8Value.c_str(), mfNoLoggedInUsers, fDropConnection));
     247
    228248                        if (fDropConnection)
    229249                        {
     
    235255                                ULONG cClients = 0;
    236256                                hrc = info->COMGETTER(NumberOfClients)(&cClients);
     257
     258                                LogRelFlow(("VRDE: connected clients=%RU32\n", cClients));
    237259                                if (SUCCEEDED(hrc) && cClients > 0)
    238260                                {
     
    249271                        }
    250272                    }
     273
     274                    LogRelFlow(("VRDE: returned with=%Rhrc\n", hrc));
    251275                }
    252276                break;
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