port: ServerStateChecker + module (batch 2 P2)

Verbatim 40250 CServerStateChecker and the ServerStateChecker Python
module replace the stub; PythonBoot owns the instance like
CPythonApplication::m_kServerStateChecker. The fake server gets a state
port that answers CG_STATE_CHECKER the way CInputHandshake and
CInputDB::RespondChannelStatus do; login_flow requests the channel list
after the character list (live: {1: 1, 2: 1}).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 00:27:35 +09:00
co-authored by Claude Opus 5.5
parent be5a68ff35
commit ce9f96398e
13 changed files with 362 additions and 32 deletions
+9 -2
View File
@@ -30,6 +30,11 @@ public:
int AuthPort() const { return m_auth_port; }
int GamePort() const { return m_game_port; }
// A third game-server port that only answers intrologin's ServerStateChecker (CG_STATE_CHECKER).
int StatePort() const { return m_state_port; }
// The channel port the state answer reports besides StatePort(), with status kOtherChannelStatus.
static constexpr int kOtherChannelPort = 13002;
static constexpr int kOtherChannelStatus = 1;
// Milestones in arrival order ("auth:login3", "game1:login2", ...), and the first protocol error.
std::vector<std::string> Events();
@@ -45,13 +50,15 @@ private:
bool ServeAuth(Connection& c);
bool ServeGame(Connection& c, int index);
bool Handshake(Connection& c, std::uint8_t phase_after);
void ServeState();
bool Accept(int listener, Connection& c);
void Event(const std::string& event);
bool Fail(const std::string& error);
int m_auth_listener = -1, m_game_listener = -1;
int m_auth_port = 0, m_game_port = 0;
std::thread m_thread;
int m_state_listener = -1;
int m_auth_port = 0, m_game_port = 0, m_state_port = 0;
std::thread m_thread, m_state_thread;
std::atomic<bool> m_stop{false};
std::mutex m_mutex;
std::vector<std::string> m_events;