Auto-reconnect is now deliberately slowed down

This commit is contained in:
2026-06-09 15:06:40 -04:00
parent 7d6b1f207f
commit 29726631dd
3 changed files with 22 additions and 4 deletions

View File

@@ -18,6 +18,8 @@ public:
PrintChanneler print_channeler_;
eng::vector<Invocation> delayed_invocations_;
lua_State *lua_syntax_checker_;
eng::string auto_reconnect_target_;
double auto_reconnect_time_ = 0.0;
public:
LpxClient(EngineWrapper *w) : wrapper_(w) {
@@ -58,6 +60,10 @@ public:
// Clear any saved invocations
delayed_invocations_.clear();
// Clear auto-reconnect state.
auto_reconnect_target_.clear();
auto_reconnect_time_ = 0.0;
}
void set_initial_state_standalone() {
@@ -83,6 +89,10 @@ public:
// Clear any saved invocations
delayed_invocations_.clear();
// Clear auto-reconnect state.
auto_reconnect_target_.clear();
auto_reconnect_time_ = 0.0;
}
// When the world is in synchronous mode, there's no
@@ -111,8 +121,9 @@ public:
void disconnect_and_reconnect() {
if (channel_)
{
eng::string target = channel_->target();
set_initial_state_connect(target);
auto_reconnect_target_ = channel_->target();
auto_reconnect_time_ = get_clock() + 5.0;
channel_.reset();
}
}
@@ -257,6 +268,10 @@ public:
}
world_to_asynchronous();
}
} else {
if ((!auto_reconnect_target_.empty()) && (get_clock() > auto_reconnect_time_)) {
set_initial_state_connect(auto_reconnect_target_);
}
}
set_have_prints(print_channeler_.have_prints(world_->get_printbuffer(actor_id_)));