From d3a339247bc3d7c4645c6b4b9df6792d745a9624 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Fri, 16 Oct 2026 21:36:52 +0200 Subject: [PATCH] Fix: reconnect after server restart without reinstalling the loader The S_SERVER_EXIT respawn fix previously lived in test.cpp, which a deployed TestRun.exe cannot pick up without reinstalling. Move the reconnect decision into ClientDll::IsStoped(): when the master instance is in S_SERVER_EXIT, report reconnectable immediately instead of waiting for live shared instances to drain, so the already-deployed loader reconnects against a hot-loaded DLL. Shared instances stay connected to their own servers, preserving the IsSharedRunning contract that the master's state change must not tear them down. Also guard the RUNNING_PARALLEL branch so re-entering StartClient on reconnect spawns parallel instances once instead of duplicating them. Co-Authored-By: deepseek-v4-pro --- client/ClientDll.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index c982d21..1a57fa8 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -445,6 +445,11 @@ extern "C" __declspec(dllexport) void StopRun() // 是否成功停止 extern "C" __declspec(dllexport) bool IsStoped() { + // 主控端重启(S_SERVER_EXIT):主实例工作线程已结束,即使分享实例仍在运行, + // 也视为「可重连」。旧 TestRun 加载循环靠它立即重连,无需卸载/重装 TestRun.exe; + // 分享实例继续存活,不受主控端重启影响。 + if (S_SERVER_EXIT == g_MyApp.g_bExit) + return true; return g_MyApp.g_bThreadExit && ClientApp::GetCount() == 0; } @@ -606,10 +611,17 @@ DWORD WINAPI StartClient(LPVOID lParam) } auto list = app.GetSharedMasterList(); if (list.size() > 1 && settings.runningType == RUNNING_PARALLEL) { - for (int i=1; i