VirtualBox

Changeset 36249 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 10, 2011 12:18:20 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70483
Message:

VBoxService/VBoxHeadless: Drop VRDP connection on manual restart / hard VM reset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r35741 r36249  
    208208                    if (fProcessDisconnectOnGuestLogout)
    209209                    {
     210                        bool fDropConnection = false;
     211
    210212                        Bstr value;
    211213                        gpcev->COMGETTER(Value)(value.asOutParam());
     
    216218                            {
    217219                                mfNoLoggedInUsers = true;
    218 
    219                                 /* If there is a connection, drop it. */
    220                                 ComPtr<IVRDEServerInfo> info;
    221                                 hrc = gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
    222                                 if (SUCCEEDED(hrc) && info)
    223                                 {
    224                                     ULONG cClients = 0;
    225                                     hrc = info->COMGETTER(NumberOfClients)(&cClients);
    226                                     if (SUCCEEDED(hrc) && cClients > 0)
    227                                     {
    228                                         ComPtr <IVRDEServer> vrdeServer;
    229                                         hrc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
    230                                         if (SUCCEEDED(hrc) && vrdeServer)
    231                                         {
    232                                             LogRel(("VRDE: the guest user has logged out, disconnecting remote clients.\n"));
    233                                             vrdeServer->COMSETTER(Enabled)(FALSE);
    234                                             vrdeServer->COMSETTER(Enabled)(TRUE);
    235                                         }
    236                                     }
    237                                 }
     220                                fDropConnection = true;
    238221                            }
     222                        }
     223                        /* Guest property got deleted due to hard reset,
     224                         * so it has no value anymore. */
     225                        else if (utf8Value.isEmpty())
     226                        {
     227                            fDropConnection = true;
    239228                        }
    240229                        else
    241230                        {
    242231                            mfNoLoggedInUsers = false;
     232                        }
     233
     234                        if (fDropConnection)
     235                        {
     236                            /* If there is a connection, drop it. */
     237                            ComPtr<IVRDEServerInfo> info;
     238                            hrc = gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
     239                            if (SUCCEEDED(hrc) && info)
     240                            {
     241                                ULONG cClients = 0;
     242                                hrc = info->COMGETTER(NumberOfClients)(&cClients);
     243                                if (SUCCEEDED(hrc) && cClients > 0)
     244                                {
     245                                    ComPtr <IVRDEServer> vrdeServer;
     246                                    hrc = machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
     247                                    if (SUCCEEDED(hrc) && vrdeServer)
     248                                    {
     249                                        LogRel(("VRDE: the guest user has logged out, disconnecting remote clients.\n"));
     250                                        vrdeServer->COMSETTER(Enabled)(FALSE);
     251                                        vrdeServer->COMSETTER(Enabled)(TRUE);
     252                                    }
     253                                }
     254                            }
    243255                        }
    244256                    }
     
    532544#endif /* VBOX_FFMPEG defined */
    533545
    534 #ifdef RT_OS_WINDOWS 
     546#ifdef RT_OS_WINDOWS
    535547// Required for ATL
    536548static CComModule _Module;
     
    13261338    pVirtualBoxClient.setNull();
    13271339    machine.setNull();
    1328  
     1340
    13291341    com::Shutdown();
    13301342
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette