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.
This commit is contained in:
lly 2019-12-14 15:43:51 +08:00
parent 83813f830d
commit bf712e4f91
2 changed files with 9 additions and 0 deletions

View File

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

View File

@ -103,6 +103,14 @@ bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(
return NULL; 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; return node;
} }