- Timestamp:
- Nov 25, 2009 4:56:40 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r24903 r24969 797 797 uint32_t uMaxDowntime = 250 /*ms*/; 798 798 uint32_t uPort = UINT32_MAX; 799 uint32_t cMsTimeout = 0; 799 800 Bstr bstrPassword(""); 800 801 static const RTGETOPTDEF s_aTeleportOptions[] = … … 804 805 { "--maxdowntime", 'd', RTGETOPT_REQ_UINT32 }, 805 806 { "--port", 'p', RTGETOPT_REQ_UINT32 }, /** @todo RTGETOPT_FLAG_MANDATORY */ 806 { "--password", 'P', RTGETOPT_REQ_STRING } 807 { "--password", 'P', RTGETOPT_REQ_STRING }, 808 { "--timeout", 't', RTGETOPT_REQ_UINT32 } 807 809 }; 808 810 RTGETOPTSTATE GetOptState; … … 819 821 case 'p': uPort = Value.u32; break; 820 822 case 'P': bstrPassword = Value.psz; break; 823 case 't': cMsTimeout = Value.u32; break; 821 824 default: 822 825 errorGetOpt(USAGE_CONTROLVM, ch, &Value); … … 830 833 ComPtr<IProgress> progress; 831 834 CHECK_ERROR_BREAK(console, Teleport(bstrHostname, uPort, bstrPassword, uMaxDowntime, progress.asOutParam())); 835 836 if (cMsTimeout) 837 { 838 rc = progress->COMSETTER(Timeout)(cMsTimeout); 839 if (FAILED(rc) && rc != VBOX_E_INVALID_OBJECT_STATE) 840 CHECK_ERROR_BREAK(progress, COMSETTER(Timeout)(cMsTimeout)); /* lazyness */ 841 } 842 832 843 rc = showProgress(progress); 833 844 if (FAILED(rc)) -
trunk/src/VBox/Main/ProgressImpl.cpp
r24961 r24969 287 287 return dPercent; 288 288 } 289 290 /** 291 * Internal helper for automatically timing out the operation. 292 * 293 * The caller should hold the object write lock. 294 */ 295 void ProgressBase::checkForAutomaticTimeout(void) 296 { 297 if ( m_cMsTimeout 298 && mCancelable 299 && !mCanceled 300 && RTTimeMilliTS() - m_ullTimestamp > m_cMsTimeout 301 ) 302 Cancel(); 303 } 304 289 305 290 306 STDMETHODIMP ProgressBase::COMGETTER(TimeRemaining)(LONG *aTimeRemaining) … … 328 344 CheckComRCReturnRC(autoCaller.rc()); 329 345 330 AutoReadLock alock(this); 346 checkForAutomaticTimeout(); 347 348 /* checkForAutomaticTimeout requires a write lock. */ 349 AutoWriteLock alock(this); 331 350 332 351 if (mCompleted && SUCCEEDED(mResultCode)) … … 346 365 } 347 366 367 checkForAutomaticTimeout(); 368 348 369 return S_OK; 349 370 } … … 562 583 AutoWriteLock alock(this); 563 584 585 checkForAutomaticTimeout(); 564 586 if (mCanceled) 565 587 return false; … … 952 974 AssertReturn(aPercent <= 100, E_INVALIDARG); 953 975 976 checkForAutomaticTimeout(); 954 977 if (mCancelable && mCanceled) 955 978 { … … 957 980 return E_FAIL; 958 981 } 959 else 960 AssertReturn(!mCompleted && !mCanceled, E_FAIL); 982 AssertReturn(!mCompleted && !mCanceled, E_FAIL); 961 983 962 984 m_ulOperationPercent = aPercent; -
trunk/src/VBox/Main/include/ProgressImpl.h
r24961 r24969 99 99 100 100 protected: 101 void checkForAutomaticTimeout(void); 101 102 102 103 #if !defined (VBOX_COM_INPROC)
Note:
See TracChangeset
for help on using the changeset viewer.