From 05e48a2cbbf2e48e1debe1e40835f9e8505eef8a Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Tue, 24 Apr 2018 20:06:53 +0100 Subject: [PATCH] net: Fix is_alive returning false by giving some leniency --- src/protocol/net/ClientSession.cpp | 4 ++-- src/protocol/net/ServerSession.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocol/net/ClientSession.cpp b/src/protocol/net/ClientSession.cpp index 9232a5a..b77506d 100644 --- a/src/protocol/net/ClientSession.cpp +++ b/src/protocol/net/ClientSession.cpp @@ -42,12 +42,12 @@ namespace net if (!m_established) return std::chrono::duration_cast( 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::steady_clock::now() - m_last_received_heartbeat_time - ).count() <= KI_SERVER_HEARTBEAT; + ).count() <= (KI_SERVER_HEARTBEAT * 2); } void ClientSession::on_connected() diff --git a/src/protocol/net/ServerSession.cpp b/src/protocol/net/ServerSession.cpp index 72efe98..dc55b66 100644 --- a/src/protocol/net/ServerSession.cpp +++ b/src/protocol/net/ServerSession.cpp @@ -34,12 +34,12 @@ namespace net if (!m_established) return std::chrono::duration_cast( 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::steady_clock::now() - m_last_received_heartbeat_time - ).count() <= KI_CLIENT_HEARTBEAT; + ).count() <= (KI_CLIENT_HEARTBEAT * 2); } void ServerSession::on_connected()