diff options
Diffstat (limited to 'src/VBox/Main/src-client/ConsoleImplTeleporter.cpp')
-rw-r--r-- | src/VBox/Main/src-client/ConsoleImplTeleporter.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp index 7e765352..e5666f3f 100644 --- a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp +++ b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010-2012 Oracle Corporation + * Copyright (C) 2010-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -239,7 +239,7 @@ Console::teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, if (!strcmp(szMsg, "ACK")) return S_OK; - if (!strncmp(szMsg, "NACK=", sizeof("NACK=") - 1)) + if (!strncmp(szMsg, RT_STR_TUPLE("NACK="))) { char *pszMsgText = strchr(szMsg, ';'); if (pszMsgText) @@ -573,7 +573,7 @@ static SSMSTRMOPS const g_teleporterTcpOps = static void teleporterProgressCancelCallback(void *pvUser) { TeleporterState *pState = (TeleporterState *)pvUser; - SSMR3Cancel(VMR3GetVM(pState->mpUVM)); + SSMR3Cancel(pState->mpUVM); if (!pState->mfIsSource) { TeleporterStateTrg *pStateTrg = (TeleporterStateTrg *)pState; @@ -584,7 +584,7 @@ static void teleporterProgressCancelCallback(void *pvUser) /** * @copydoc PFNVMPROGRESS */ -static DECLCALLBACK(int) teleporterProgressCallback(PVM pVM, unsigned uPercent, void *pvUser) +static DECLCALLBACK(int) teleporterProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser) { TeleporterState *pState = (TeleporterState *)pvUser; if (pState->mptrProgress) @@ -597,12 +597,13 @@ static DECLCALLBACK(int) teleporterProgressCallback(PVM pVM, unsigned uPercent, hrc = pState->mptrProgress->COMGETTER(Canceled)(&fCanceled); if (SUCCEEDED(hrc) && fCanceled) { - SSMR3Cancel(VMR3GetVM(pState->mpUVM)); + SSMR3Cancel(pState->mpUVM); return VERR_SSM_CANCELLED; } } } + NOREF(pUVM); return VINF_SUCCESS; } @@ -685,7 +686,7 @@ Console::teleporterSrc(TeleporterStateSrc *pState) RTSocketRetain(pState->mhSocket); void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); - vrc = VMR3Teleport(VMR3GetVM(pState->mpUVM), + vrc = VMR3Teleport(pState->mpUVM, pState->mcMsMaxDowntime, &g_teleporterTcpOps, pvUser, teleporterProgressCallback, pvUser, @@ -810,7 +811,11 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser) ptrVM.release(); pState->mptrConsole->mVMIsAlreadyPoweringOff = true; /* (Make sure we stick in the TeleportingPausedVM state.) */ + autoLock.release(); + hrc = pState->mptrConsole->powerDown(); + + autoLock.acquire(); pState->mptrConsole->mVMIsAlreadyPoweringOff = false; pState->mptrProgress->notifyComplete(hrc); @@ -886,7 +891,7 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser) if (pState->mfSuspendedByUs) { autoLock.release(); - int rc = VMR3Resume(VMR3GetVM(pState->mpUVM)); + int rc = VMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORT_FAILED); AssertLogRelMsgRC(rc, ("VMR3Resume -> %Rrc\n", rc)); autoLock.acquire(); } @@ -932,7 +937,7 @@ Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxD */ CheckComArgOutPointerValid(aProgress); CheckComArgStrNotEmptyOrNull(aHostname); - CheckComArgStrNotEmptyOrNull(aPassword); + CheckComArgNotNull(aPassword); CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort)); CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime)); @@ -1337,18 +1342,18 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser) if (RT_FAILURE(vrc)) break; - int vrc2 = VMR3AtErrorRegisterU(pState->mpUVM, - Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); + int vrc2 = VMR3AtErrorRegister(pState->mpUVM, + Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); RTSocketRetain(pState->mhSocket); /* For concurrent access by I/O thread and EMT. */ pState->moffStream = 0; void *pvUser2 = static_cast<void *>(static_cast<TeleporterState *>(pState)); - vrc = VMR3LoadFromStream(VMR3GetVM(pState->mpUVM), + vrc = VMR3LoadFromStream(pState->mpUVM, &g_teleporterTcpOps, pvUser2, teleporterProgressCallback, pvUser2); RTSocketRelease(pState->mhSocket); - vrc2 = VMR3AtErrorDeregister(VMR3GetVM(pState->mpUVM), Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); + vrc2 = VMR3AtErrorDeregister(pState->mpUVM, Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2); if (RT_FAILURE(vrc)) { @@ -1411,7 +1416,7 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser) if (RT_SUCCESS(vrc)) { if (!strcmp(szCmd, "hand-over-resume")) - vrc = VMR3Resume(VMR3GetVM(pState->mpUVM)); + vrc = VMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORTED); else pState->mptrConsole->setMachineState(MachineState_Paused); fDone = true; |