made it so a negative kHeartRate disables heartbeats and set
kHeartRate to -1.
This commit is contained in:
parent
da361e9686
commit
0d70150589
|
@ -66,7 +66,8 @@ CServerProxy::mainLoop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for time out
|
// check for time out
|
||||||
if (n == (UInt32)-1 || heartbeat.getTime() > kHeartRate) {
|
if (n == (UInt32)-1 ||
|
||||||
|
(kHeartRate >= 0.0 && heartbeat.getTime() > kHeartRate)) {
|
||||||
// send heartbeat
|
// send heartbeat
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
CProtocolUtil::writef(getOutputStream(), kMsgCNoop);
|
||||||
|
|
|
@ -80,12 +80,10 @@ CClientProxy1_0::mainLoop()
|
||||||
|
|
||||||
// check if client has stopped sending heartbeats
|
// check if client has stopped sending heartbeats
|
||||||
if (n == (UInt32)-1) {
|
if (n == (UInt32)-1) {
|
||||||
/* FIXME -- disabled to avoid masking bugs
|
if (kHeartDeath >= 0.0 && heartTimer.getTime() > kHeartDeath) {
|
||||||
if (heartTimer.getTime() > kHeartDeath) {
|
|
||||||
log((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
|
log((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,11 @@ static const UInt16 kDefaultPort = 24800;
|
||||||
// maximum total length for greeting returned by client
|
// maximum total length for greeting returned by client
|
||||||
static const UInt32 kMaxHelloLength = 1024;
|
static const UInt32 kMaxHelloLength = 1024;
|
||||||
|
|
||||||
// time between heartbeats (in seconds)
|
// time between heartbeats (in seconds). negative value disables
|
||||||
static const double kHeartRate = 2.0;
|
// heartbeat.
|
||||||
|
static const double kHeartRate = -1.0;
|
||||||
|
|
||||||
// time without a heartbeat that we call death
|
// time without a heartbeat that constitutes death
|
||||||
static const double kHeartDeath = 3.0 * kHeartRate;
|
static const double kHeartDeath = 3.0 * kHeartRate;
|
||||||
|
|
||||||
// direction constants
|
// direction constants
|
||||||
|
|
Loading…
Reference in New Issue