Skip to content
Commit cc334912 authored by Rene Beckmann's avatar Rene Beckmann Committed by Fabio Baltieri
Browse files

net: mqtt-sn: Wait for register & subscribe to complete



From the MQTT-SN spec:

6.5 Topic Name Registration Procedure

...
At any point in time a client may have only one
REGISTER message outstanding, i.e. it has to wait
for a REGACK message before it can register another
topic name.
...

6.9 Client’s Topic Subscribe/Un-subscribe Procedure

...
As for the REGISTER procedure, a client may have only
one SUBSCRIBE or one UNSUBCRIBE transaction open at a time.
...

Until now, the library did not comply with these requirements.
An additional "waiting" state for topics was introduced:
REGISTER, SUBSCRIBE and UNSUBSCRIBE as an extra step before
switching to REGISTERING, SUBSCRIBING and UNSUBSCRIBING. The
library now makes sure that only one topic can be REGISTERING
and only one topic can be in either SUBSCRIBING or UNSUBSCRIBING.
Additionally, requesting to UNSUBSCRIBE is now denied if the topic
is not yet SUBSCRIBED, to avoid weird race conditions.

Also, added two tests that verify this behavior.

This fixes #84644

Signed-off-by: default avatarRene Beckmann <rene.bckmnn@gmail.com>
parent 25c78a25
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment