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:
co-authored by
Claude Opus 5.5
parent
be5a68ff35
commit
ce9f96398e
@@ -269,6 +269,34 @@ int main(int argc, char** argv)
|
||||
"assert net.GetEmpireID() in (1, 2, 3), net.GetEmpireID()"));
|
||||
}
|
||||
|
||||
// 3b. intrologin's channel status list (__RequestServerStateList / NotifyChannelState): ServerStateChecker
|
||||
// connects to the first channel, sends CG_STATE_CHECKER and reports each channel the answer lists
|
||||
// by port. TChannelStatus::nPort is a short, so the fake server's ephemeral state port (> 32767)
|
||||
// never matches its own channel; offline the proof is the second channel (13002) it also lists.
|
||||
// Live the game port answers for the channels the db knows, the game port among them.
|
||||
{
|
||||
const int state_port = server ? server->StatePort() : game_port;
|
||||
const int key = server ? 2 : 1;
|
||||
char channels[256];
|
||||
std::snprintf(channels, sizeof(channels),
|
||||
"ServerStateChecker.AddChannel(1, _host, %d)\nServerStateChecker.AddChannel(2, _host, %d)\n"
|
||||
"_channel_key = %d\n",
|
||||
state_port, FakeLoginServer::kOtherChannelPort, key);
|
||||
CHECK(py(std::string("import ServerStateChecker\n"
|
||||
"class _ChannelStates:\n"
|
||||
" def __init__(self): self.states = {}\n"
|
||||
" def NotifyChannelState(self, key, state): self.states[key] = state\n"
|
||||
"_channel_states = _ChannelStates()\n"
|
||||
"ServerStateChecker.Create(_channel_states)\n"
|
||||
"ServerStateChecker.Initialize()\n") +
|
||||
channels + "ServerStateChecker.Request()"));
|
||||
CHECK(pump_until(10, [] { return py("ServerStateChecker.Update()") && py_true("_channel_key in _channel_states.states"); }));
|
||||
py("import sys\nsys.stderr.write('port_login_flow_test: channel states %r\\n' % _channel_states.states)");
|
||||
CHECK(py_true("_channel_states.states.get(_channel_key, 0) > 0"));
|
||||
if (server)
|
||||
CHECK(server->Has("state:checker"));
|
||||
}
|
||||
|
||||
// 4-5. Start the game on the slot: DirectEnter, the second game login and the loading phase.
|
||||
if (selecting)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user