net: mqtt-sn: Remember incoming registered topic name

When a client uses wildcard subscription and a new message is
published to the matching topic for the first time, the gateway
sends REGISTER message to the client, containing the exact
topic name and a new topic ID.
This change fixes adding these topic ID and name to the internal
topics list.

Signed-off-by: Alexander Vasiliev <alexander.vasiliev@siemens.com>
This commit is contained in:
Alexander Vasiliev 2023-11-02 16:38:12 +00:00 committed by Carles Cufí
parent 6caf76346a
commit 76276e2bd3

View File

@ -949,6 +949,8 @@ static void handle_register(struct mqtt_sn_client *client, struct mqtt_sn_param_
topic->topic_id = p->topic_id;
topic->type = MQTT_SN_TOPIC_TYPE_NORMAL;
sys_slist_append(&client->topic, &topic->next);
response.params.regack.ret_code = MQTT_SN_CODE_ACCEPTED;
response.params.regack.topic_id = p->topic_id;
response.params.regack.msg_id = p->msg_id;