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

@@ -15,3 +15,6 @@ AutoSaveWarningInSeconds=0
[/Script/Integration.lxProjectSettings] [/Script/Integration.lxProjectSettings]
ActiveServer=/Game/Luprex/KnownServers/SS_Standalone.SS_Standalone ActiveServer=/Game/Luprex/KnownServers/SS_Standalone.SS_Standalone
[/Script/Integration.lxEditorSettings]
ActiveServer=/Game/Luprex/KnownServers/SS_Localhost.SS_Localhost

Binary file not shown.

View File

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