Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sample_data/docker-compose-dl-streamer-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ services:
- TRACKER_MANAGER_CA_CERT_PATH=/run/secrets/certs/scenescape-ca.pem
- TRACKER_SCENES_SOURCE=api
# Override host proxy settings - Paho MQTT dont respect no_proxy var, so as a WA
# tracker code detects empty vars and unsets them (see mqtt_client.cpp clearEmptyProxyVars)
# tracker code detects empty vars and unsets them (see proxy_utils.cpp clearEmptyProxyEnvVars)
- http_proxy=
- https_proxy=
- HTTP_PROXY=
Expand Down
19 changes: 19 additions & 0 deletions tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/inc
)

# Apply strict compiler flags only to the tracker target
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-fcf-protection=full" COMPILER_SUPPORTS_CF_PROTECTION)

target_compile_options(${PROJECT_NAME}
PRIVATE
-Wall -Wextra -Werror -Wconversion -Wimplicit-fallthrough
-Wno-missing-field-initializers
$<$<BOOL:${COMPILER_SUPPORTS_CF_PROTECTION}>:-fcf-protection=full>
)

# Treat RobotVision headers as system includes to suppress third-party warnings
if(TARGET RobotVision)
get_target_property(_rv_inc RobotVision INTERFACE_INCLUDE_DIRECTORIES)
if(_rv_inc)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${_rv_inc})
endif()
endif()

# Inject version info as compile definitions
target_compile_definitions(${PROJECT_NAME}
PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion tracker/inc/scene_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ inline std::array<double, 3> require_array3(const rapidjson::Value& doc, const c
if (auto* val = Pointer(pointer).Get(doc)) {
if (val->IsArray() && val->Size() == 3) {
std::array<double, 3> result;
for (size_t i = 0; i < 3; ++i) {
for (rapidjson::SizeType i = 0; i < 3; ++i) {
if (!(*val)[i].IsNumber()) {
throw std::runtime_error(context + ": " + pointer + "[" + std::to_string(i) +
"] must be a number");
Expand Down
2 changes: 1 addition & 1 deletion tracker/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ std::atomic<bool> g_liveness{false};
std::atomic<bool> g_readiness{false};
std::shared_ptr<tracker::MqttClient> g_mqtt_client;

void signal_handler(int signal) {
void signal_handler(int /*signal*/) {
g_shutdown_requested = ShutdownReason::SIGNAL;
}

Expand Down
2 changes: 1 addition & 1 deletion tracker/src/message_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void MessageHandler::routeMessage(const std::string& topic, const std::string& p
}

void MessageHandler::handleDatabaseUpdateMessage(const std::string& topic,
const std::string& payload) {
[[maybe_unused]] const std::string& payload) {
LOG_INFO_ENTRY(LogEntry("Database update received, triggering restart")
.component("message_handler")
.mqtt({.topic = topic, .direction = "subscribe"}));
Expand Down
32 changes: 0 additions & 32 deletions tracker/src/mqtt_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,6 @@ std::string getHostname() {
return "unknown";
}

/**
* @brief Clear proxy environment variables if they are set but empty.
*
* Paho MQTT library workaround: Paho reads proxy environment variables
* (http_proxy, https_proxy, etc.) but fails when they are set to empty
* strings - it attempts to use "" as a proxy URL, causing connection errors.
*
* This commonly occurs when:
* - Docker containers set proxy vars to empty to override host values
* - Makefile targets export empty proxy vars for local development
*
* Solution: Detect empty proxy vars and unset them entirely, while
* preserving real proxy URLs for production environments that need them.
*/
void clearEmptyProxyVars() {
const char* proxy_vars[] = {"http_proxy", "HTTP_PROXY", "https_proxy",
"HTTPS_PROXY", "no_proxy", "NO_PROXY"};

bool cleared_any = false;
for (const char* var : proxy_vars) {
const char* value = std::getenv(var);
if (value != nullptr && value[0] == '\0') {
unsetenv(var);
cleared_any = true;
}
}

if (cleared_any) {
LOG_DEBUG("Cleared empty proxy environment variables");
}
}

} // namespace

std::string MqttClient::generateClientId() {
Expand Down
Loading