mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-17 04:26:47 +08:00
[feat] attempt to rejoin once per second
This commit is contained in:
@@ -101,7 +101,15 @@ int Render::RemoteWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check every 1 second for rejoin
|
||||||
if (need_to_rejoin_) {
|
if (need_to_rejoin_) {
|
||||||
|
auto now = std::chrono::steady_clock::now();
|
||||||
|
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
now - last_rejoin_check_time_)
|
||||||
|
.count();
|
||||||
|
|
||||||
|
if (elapsed >= 1000) {
|
||||||
|
last_rejoin_check_time_ = now;
|
||||||
need_to_rejoin_ = false;
|
need_to_rejoin_ = false;
|
||||||
for (const auto& [_, props] : client_properties_) {
|
for (const auto& [_, props] : client_properties_) {
|
||||||
if (props->rejoin_) {
|
if (props->rejoin_) {
|
||||||
@@ -111,6 +119,7 @@ int Render::RemoteWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ SDL_HitTestResult Render::HitTestCallback(SDL_Window* window,
|
|||||||
return SDL_HITTEST_NORMAL;
|
return SDL_HITTEST_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Render::Render() {}
|
Render::Render() : last_rejoin_check_time_(std::chrono::steady_clock::now()) {}
|
||||||
|
|
||||||
Render::~Render() {}
|
Render::~Render() {}
|
||||||
|
|
||||||
|
|||||||
@@ -379,6 +379,7 @@ class Render {
|
|||||||
int audio_len_ = 0;
|
int audio_len_ = 0;
|
||||||
bool audio_buffer_fresh_ = false;
|
bool audio_buffer_fresh_ = false;
|
||||||
bool need_to_rejoin_ = false;
|
bool need_to_rejoin_ = false;
|
||||||
|
std::chrono::steady_clock::time_point last_rejoin_check_time_;
|
||||||
bool just_created_ = false;
|
bool just_created_ = false;
|
||||||
std::string controlled_remote_id_ = "";
|
std::string controlled_remote_id_ = "";
|
||||||
std::string focused_remote_id_ = "";
|
std::string focused_remote_id_ = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user