mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
network::monitor: Fix ConnectionInactivityChecker.
This commit is contained in:
parent
cc1888b3e0
commit
febead2e0f
@ -42,8 +42,22 @@ std::shared_ptr<StatCollector> ConnectionInactivityChecker::createStatCollector(
|
||||
}
|
||||
|
||||
bool ConnectionInactivityChecker::check(const ConnectionStats& stats, v_int64 currMicroTime) {
|
||||
return currMicroTime - stats.timestampLastRead < m_lastReadTimeout.count() &&
|
||||
currMicroTime - stats.timestampLastWrite < m_lastWriteTimeout.count();
|
||||
|
||||
bool goodRead;
|
||||
if(stats.timestampLastRead == 0) {
|
||||
goodRead = currMicroTime - stats.timestampCreated < m_lastReadTimeout.count();
|
||||
} else {
|
||||
goodRead = currMicroTime - stats.timestampLastRead < m_lastReadTimeout.count();
|
||||
}
|
||||
|
||||
bool goodWrite;
|
||||
if(stats.timestampLastWrite == 0) {
|
||||
goodWrite = currMicroTime - stats.timestampCreated < m_lastWriteTimeout.count();
|
||||
} else {
|
||||
goodWrite = currMicroTime - stats.timestampLastWrite < m_lastWriteTimeout.count();
|
||||
}
|
||||
|
||||
return goodRead && goodWrite;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
Loading…
Reference in New Issue
Block a user