Skip to content

Commit

Permalink
Fix MQTT v5 overlapping subscription behaviour.
Browse files Browse the repository at this point in the history
Clients now receive message from all matching subscriptions rather than
the first one encountered, which ensures the maximum QoS requirement is
met.
  • Loading branch information
ralight committed May 29, 2019
1 parent de695af commit 142d07f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Broker:
- Fix incorrect shared subscription topic '$shared'.
- Fix zero length client ids being rejected for MQTT v5 clients with clean
start set to true.
- Fix MQTT v5 overlapping subscription behaviour. Clients now receive message
from all matching subscriptions rather than the first one encountered, which
ensures the maximum QoS requirement is met.

Client library:
- Fix typo causing build error on Windows when building without TLS support.
Expand Down
3 changes: 2 additions & 1 deletion src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ int db__message_insert(struct mosquitto_db *db, struct mosquitto *context, uint1
* multiple times for overlapping subscriptions, although this is only the
* case for SUBSCRIPTION with multiple subs in so is a minor concern.
*/
if(db->config->allow_duplicate_messages == false
if(context->protocol != mosq_p_mqtt5
&& db->config->allow_duplicate_messages == false
&& dir == mosq_md_out && retain == false && stored->dest_ids){

for(i=0; i<stored->dest_id_count; i++){
Expand Down

0 comments on commit 142d07f

Please sign in to comment.