mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-06-30 01:34:42 +08:00
Validate MQTT goodbye session id (#2023)
Co-authored-by: Codex <codex@local>
This commit is contained in:
@@ -114,8 +114,8 @@ bool MqttProtocol::StartMqttClient(bool report_error) {
|
||||
ParseServerHello(root);
|
||||
} else if (strcmp(type->valuestring, "goodbye") == 0) {
|
||||
auto session_id = cJSON_GetObjectItem(root, "session_id");
|
||||
ESP_LOGI(TAG, "Received goodbye message, session_id: %s", session_id ? session_id->valuestring : "null");
|
||||
if (session_id == nullptr || session_id_ == session_id->valuestring) {
|
||||
ESP_LOGI(TAG, "Received goodbye message, session_id: %s", cJSON_IsString(session_id) ? session_id->valuestring : "null");
|
||||
if (cJSON_IsString(session_id) && session_id_ == session_id->valuestring) {
|
||||
auto alive = alive_; // Capture alive flag
|
||||
Application::GetInstance().Schedule([this, alive]() {
|
||||
if (*alive) {
|
||||
|
||||
Reference in New Issue
Block a user