mirror of https://github.com/SeanOMik/libki.git
net: Fix is_alive returning false by giving some leniency
This commit is contained in:
parent
9c6a756f68
commit
05e48a2cbb
|
@ -42,12 +42,12 @@ namespace net
|
|||
if (!m_established)
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::steady_clock::now() - m_creation_time
|
||||
).count() <= KI_CONNECTION_TIMEOUT;
|
||||
).count() <= (KI_CONNECTION_TIMEOUT * 2);
|
||||
|
||||
// Otherwise, use the last time we received a heartbeat.
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::steady_clock::now() - m_last_received_heartbeat_time
|
||||
).count() <= KI_SERVER_HEARTBEAT;
|
||||
).count() <= (KI_SERVER_HEARTBEAT * 2);
|
||||
}
|
||||
|
||||
void ClientSession::on_connected()
|
||||
|
|
|
@ -34,12 +34,12 @@ namespace net
|
|||
if (!m_established)
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::steady_clock::now() - m_creation_time
|
||||
).count() <= KI_CONNECTION_TIMEOUT;
|
||||
).count() <= (KI_CONNECTION_TIMEOUT * 2);
|
||||
|
||||
// Otherwise, use the last time we received a heartbeat.
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::steady_clock::now() - m_last_received_heartbeat_time
|
||||
).count() <= KI_CLIENT_HEARTBEAT;
|
||||
).count() <= (KI_CLIENT_HEARTBEAT * 2);
|
||||
}
|
||||
|
||||
void ServerSession::on_connected()
|
||||
|
|
Loading…
Reference in New Issue