Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.7 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // TaskPollingCallback.h
  7. //
  8. // Description:
  9. // CTaskPollingCallback implementation.
  10. //
  11. // Maintained By:
  12. // Galen Barbee (GalenB) 10-JUL-2000
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #pragma once
  16. //
  17. // Timeout controlling how long TaskPollingCallback should retry until it gives up.
  18. //
  19. const DWORD TPC_FAILURE_TIMEOUT = CC_DEFAULT_TIMEOUT;
  20. //
  21. // TaskPollingCallback's poll interval. The interval is the time to wait before calling into
  22. // the server to check for a queued status report.
  23. //
  24. const DWORD TPC_POLL_INTERVAL = 1000; // 1 second
  25. //
  26. // How long TaskPollingCallback should wait before retrying GetStatusReport() after a failure.
  27. //
  28. const DWORD TPC_WAIT_AFTER_FAILURE = 10000; // 10 seconds
  29. //
  30. // How many times should TaskPollingCallback retry after a failure. The count is the timeout value
  31. // divided by the failure wait time. This allows us to determine how much approximate time should
  32. // elapse before giving up.
  33. //
  34. #if defined( DEBUG ) && defined( CCS_SIMULATE_RPC_FAILURE )
  35. const DWORD TPC_MAX_RETRIES_ON_FAILURE = TPC_FAILURE_TIMEOUT / TPC_WAIT_AFTER_FAILURE / 4; // Want simulated failures 4 times sooner...
  36. #else
  37. const DWORD TPC_MAX_RETRIES_ON_FAILURE = TPC_FAILURE_TIMEOUT / TPC_WAIT_AFTER_FAILURE; // Number of times to retry the operation (5 minute timeout)
  38. #endif
  39. // CTaskPollingCallback
  40. class CTaskPollingCallback
  41. : public ITaskPollingCallback
  42. {
  43. private:
  44. // IUnknown
  45. LONG m_cRef;
  46. // IDoTask/ITaskPollingCallback
  47. bool m_fStop;
  48. DWORD m_dwRemoteServerObjectGITCookie; // The GIT cookie for the server side object.
  49. OBJECTCOOKIE m_cookieLocalServerObject; // Object Manager cookie for the client side server proxy object.
  50. private: // Methods
  51. CTaskPollingCallback( void );
  52. ~CTaskPollingCallback( void );
  53. STDMETHOD( HrInit )( void );
  54. public: // Methods
  55. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  56. // IUnknown
  57. STDMETHOD( QueryInterface )( REFIID riidIn, LPVOID * ppvOut );
  58. STDMETHOD_( ULONG, AddRef )( void );
  59. STDMETHOD_( ULONG, Release )( void );
  60. // IDoTask/ITaskPollingCallback
  61. STDMETHOD( BeginTask )( void );
  62. STDMETHOD( StopTask )( void );
  63. STDMETHOD( SetServerInfo )( DWORD dwRemoteServerObjectGITCookieIn, OBJECTCOOKIE cookieLocalServerObjectIn );
  64. }; //*** class CTaskPollingCallback