ENH:periodic request full push

when the printer does not push any data packets,
request data from the printer at intervals

Change-Id: I4c84586301588f6a14f65d7a732d22f57bce59c9
This commit is contained in:
tao wang 2023-07-07 15:52:33 +08:00 committed by Lane.Wei
parent 18a5575bbc
commit 7ffeb1a432
2 changed files with 7 additions and 2 deletions

View file

@ -4350,11 +4350,16 @@ void DeviceManager::keep_alive()
obj->keep_alive_count++;
std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
auto internal = std::chrono::duration_cast<std::chrono::milliseconds>(start - obj->last_keep_alive);
if (internal.count() > TIMEOUT_FOR_KEEPALIVE && internal.count() < 1000 * 60 * 60 * 300) {
if (internal.count() > TIMEOUT_FOR_KEEPALIVE && (internal.count() < 1000 * 60 * 60 * 300) ) {
BOOST_LOG_TRIVIAL(info) << "keep alive = " << internal.count() << ", count = " << obj->keep_alive_count;
obj->command_request_push_all();
obj->last_keep_alive = start;
}
else if(obj->m_push_count == 0){
BOOST_LOG_TRIVIAL(info) << "keep alive = " << internal.count() << ", push_count = 0, count = " << obj->keep_alive_count;
obj->command_request_push_all();
obj->last_keep_alive = start;
}
}
}