Răsfoiți Sursa

ble_mesh: Client model check timer remaining time

Before handling status message, client models need check if the
corresponding timer has expired. And if timeout happens, the
status message will be treated as a publish message.
lly 6 ani în urmă
părinte
comite
d2bc597e9f

+ 1 - 0
components/bt/esp_ble_mesh/mesh_common/mesh_kernel.c

@@ -173,6 +173,7 @@ int k_delayed_work_free(struct k_delayed_work *work)
         return -EINVAL;
     }
 
+    osi_alarm_cancel(alarm);
     hash_map_erase(bm_alarm_hash_map, work);
     return 0;
 }

+ 8 - 0
components/bt/esp_ble_mesh/mesh_models/client/client_common.c

@@ -103,6 +103,14 @@ bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(
         return NULL;
     }
 
+    if (k_delayed_work_remaining_get(&node->timer) == 0) {
+        BT_DBG("Unexpected status message 0x%x", ctx->recv_op);
+        if (cli->publish_status && need_pub) {
+            cli->publish_status(ctx->recv_op, model, ctx, buf);
+        }
+        return NULL;
+    }
+
     return node;
 }