Changeset 23904 in vbox for trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
- Timestamp:
- Oct 20, 2009 3:01:56 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53705
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r23841 r23904 92 92 Utf8Str mstrHostname; 93 93 uint32_t muPort; 94 95 TeleporterStateSrc(Console *pConsole, PVM pVM, Progress *pProgress) 94 MachineState_T menmOldMachineState; 95 96 TeleporterStateSrc(Console *pConsole, PVM pVM, Progress *pProgress, MachineState_T enmOldMachineState) 96 97 : TeleporterState(pConsole, pVM, pProgress, true /*fIsSource*/) 97 98 , muPort(UINT32_MAX) 99 , menmOldMachineState(enmOldMachineState) 98 100 { 99 101 } … … 110 112 PRTTCPSERVER mhServer; 111 113 PRTTIMERLR mphTimerLR; 114 bool mfStartPaused; 112 115 int mRc; 113 116 114 117 TeleporterStateTrg(Console *pConsole, PVM pVM, Progress *pProgress, 115 IMachine *pMachine, PRTTIMERLR phTimerLR )118 IMachine *pMachine, PRTTIMERLR phTimerLR, bool fStartPaused) 116 119 : TeleporterState(pConsole, pVM, pProgress, false /*fIsSource*/) 117 120 , mpMachine(pMachine) 118 121 , mhServer(NULL) 119 122 , mphTimerLR(phTimerLR) 123 , mfStartPaused(false) 120 124 , mRc(VINF_SUCCESS) 121 125 { … … 617 621 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); 618 622 vrc = VMR3Teleport(pState->mpVM, &g_teleporterTcpOps, pvUser, teleporterProgressCallback, pvUser); 619 if ( vrc)623 if (RT_FAILURE(vrc)) 620 624 return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc); 621 625 … … 623 627 if (FAILED(hrc)) 624 628 return hrc; 629 630 /* 631 * If we're paused, mention this to the target side. 632 * 633 * Note: This means you have to resume the target manually if you pause it 634 * during the teleportation. 635 */ 636 if ( vrc == VINF_SSM_LIVE_SUSPENDED 637 || pState->menmOldMachineState == MachineState_Paused) 638 { 639 hrc = teleporterSrcSubmitCommand(pState, "pause"); 640 if (FAILED(hrc)) 641 return hrc; 642 } 625 643 626 644 /* … … 686 704 case VMSTATE_RESETTING: 687 705 case VMSTATE_RESETTING_LS: 688 pState->mptrConsole->setMachineState(MachineState_Running); 706 if (pState->menmOldMachineState == MachineState_Running) 707 pState->mptrConsole->setMachineState(MachineState_Running); 708 else 709 pState->mptrConsole->setMachineState(MachineState_Paused); 689 710 break; 690 711 case VMSTATE_GURU_MEDITATION: … … 777 798 CheckComRCReturnRC(hrc); 778 799 779 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress );800 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress, mMachineState); 780 801 pState->mstrPassword = aPassword; 781 802 pState->mstrHostname = aHostname; … … 888 909 * Do the job, when it returns we're done. 889 910 */ 890 TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR );911 TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR, fStartPaused); 891 912 State.mstrPassword = strPassword; 892 913 State.mhServer = hServer; … … 904 925 if (RT_SUCCESS(vrc)) 905 926 { 906 if ( fStartPaused)927 if (State.mfStartPaused) 907 928 setMachineState(MachineState_Paused); 908 929 else … … 1085 1106 1086 1107 vrc = teleporterTcpWriteACK(pState); 1087 if (RT_FAILURE(vrc))1088 break;1089 1108 } 1090 1109 /** @todo implement config verification and hardware compatability checks. Or … … 1096 1115 LogRel(("Teleporter: Received cancel command.\n")); 1097 1116 vrc = VERR_SSM_CANCELLED; 1117 } 1118 else if (!strcmp(szCmd, "pause")) 1119 { 1120 pState->mfStartPaused = true; 1121 vrc = teleporterTcpWriteACK(pState); 1098 1122 } 1099 1123 else if (!strcmp(szCmd, "done")) … … 1118 1142 break; 1119 1143 } 1144 1145 if (RT_FAILURE(vrc)) 1146 break; 1120 1147 } 1121 1148
Note:
See TracChangeset
for help on using the changeset viewer.