00001 00032 #ifndef LL_LLHEARTBEAT_H 00033 #define LL_LLHEARTBEAT_H 00034 00035 #include "linden_common.h" 00036 00037 #include "lltimer.h" 00038 00039 // Note: Win32 does not support the heartbeat/smackdown system; 00040 // heartbeat-delivery turns into a no-op there. 00041 00042 class LLHeartbeat 00043 { 00044 public: 00045 // secs_between_heartbeat: after a heartbeat is successfully delivered, 00046 // we suppress sending more for this length of time. 00047 // aggressive_heartbeat_panic_secs: if we've been failing to 00048 // successfully deliver heartbeats for this length of time then 00049 // we block for a while until we're really sure we got one delivered. 00050 // aggressive_heartbeat_max_blocking_secs: this is the length of 00051 // time we block for when we're aggressively ensuring that a 'panic' 00052 // heartbeat was delivered. 00053 LLHeartbeat(F32 secs_between_heartbeat = 5.0f, 00054 F32 aggressive_heartbeat_panic_secs = 10.0f, 00055 F32 aggressive_heartbeat_max_blocking_secs = 4.0f); 00056 ~LLHeartbeat(); 00057 00058 bool send(F32 timeout_sec = 0.0f); 00059 void setSuppressed(bool is_suppressed); 00060 00061 private: 00062 int rawSend(); 00063 int rawSendWithTimeout(F32 timeout_sec); 00064 F32 mSecsBetweenHeartbeat; 00065 F32 mAggressiveHeartbeatPanicSecs; 00066 F32 mAggressiveHeartbeatMaxBlockingSecs; 00067 bool mSuppressed; 00068 LLTimer mBeatTimer; 00069 LLTimer mPanicTimer; 00070 LLTimer mTimeoutTimer; 00071 }; 00072 00073 #endif // LL_HEARTBEAT_H