fix: telemetry init was in client-only path, not server path
TelemetrySocket/Emitter::create() was inside the --connect-now block (client mode). Moved to after both server and client network setup so it runs in server mode too. Also added connect failure logging to aid debugging.
This commit is contained in:
+5
-4
@@ -1499,10 +1499,6 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
|
||||
NetworkConfig::get()->setIsLAN();
|
||||
STKHost::create();
|
||||
|
||||
// Initialize telemetry system (no-op if STK_TELEMETRY_SOCKET not set).
|
||||
TelemetrySocket::create();
|
||||
TelemetryEmitter::create();
|
||||
|
||||
if (!GUIEngine::isNoGraphics())
|
||||
NetworkingLobby::getInstance()->setJoinedServer(server);
|
||||
else if (NetworkConfig::get()->isClient())
|
||||
@@ -1550,6 +1546,11 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
|
||||
NetworkConfig::get()->setAutoConnect(true);
|
||||
}
|
||||
|
||||
// Initialize telemetry system (no-op if STK_TELEMETRY_SOCKET not set).
|
||||
// Placed after server/client network setup so it works in both modes.
|
||||
TelemetrySocket::create();
|
||||
TelemetryEmitter::create();
|
||||
|
||||
if (CommandLine::has("--capture-limit", &n))
|
||||
{
|
||||
RaceManager::get()->setHitCaptureTime(n, 0.0f);
|
||||
|
||||
@@ -116,9 +116,10 @@ void TelemetrySocket::tryConnect()
|
||||
if (errno != EINPROGRESS)
|
||||
{
|
||||
// Connection failed immediately (collector not running yet).
|
||||
Log::info("Telemetry", "connect(%s) failed: %s",
|
||||
m_socket_path.c_str(), strerror(errno));
|
||||
close(m_fd);
|
||||
m_fd = -1;
|
||||
// Only log once per cooldown cycle to avoid spam.
|
||||
return;
|
||||
}
|
||||
// EINPROGRESS: connection pending — we'll detect success/failure on next write.
|
||||
@@ -153,6 +154,9 @@ void TelemetrySocket::sendFrame(const uint8_t* data, size_t size)
|
||||
if (m_fd < 0)
|
||||
{
|
||||
m_frames_dropped++;
|
||||
if (m_frames_dropped % 100 == 1)
|
||||
Log::info("Telemetry", "No connection, dropped %llu frames so far",
|
||||
(unsigned long long)m_frames_dropped);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user