Skip to content

Commit

Permalink
Fix MQTT v5 sub opts being set for v3 subs.
Browse files Browse the repository at this point in the history
Closes #1353. Thanks to Ben Barbour.
  • Loading branch information
ralight committed Jul 24, 2019
1 parent 2b2afc9 commit 3ad7808
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.txt
Expand Up @@ -7,6 +7,10 @@ Broker:
- Windows: Allow other applications access to the log file when running.
Closes #515.

Client library:
- Fix MQTT v5 subscription options being incorrectly set for MQTT v3
subscriptions. Closes #1353.


1.6.3 - 20190618
================
Expand Down
3 changes: 3 additions & 0 deletions lib/actions.c
Expand Up @@ -200,6 +200,9 @@ int mosquitto_subscribe_multiple(struct mosquitto *mosq, int *mid, int sub_count
return MOSQ_ERR_OVERSIZE_PACKET;
}
}
if(mosq->protocol == mosq_p_mqtt311 || mosq->protocol == mosq_p_mqtt31){
options = 0;
}

return send__subscribe(mosq, mid, sub_count, sub, qos|options, outgoing_properties);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/mosquitto.h
Expand Up @@ -921,8 +921,9 @@ libmosq_EXPORT int mosquitto_subscribe_v5(struct mosquitto *mosq, int *mid, cons
* familiar with this, just think of it as a safer "char **",
* equivalent to "const char *" for a simple string pointer.
* qos - the requested Quality of Service for each subscription.
* options - options to apply to this subscription, OR'd together. Set to 0 to
* use the default options, otherwise choose from the list:
* options - options to apply to this subscription, OR'd together. This
* argument is not used for MQTT v3 susbcriptions. Set to 0 to use
* the default options, otherwise choose from the list:
* MQTT_SUB_OPT_NO_LOCAL - with this option set, if this client
* publishes to a topic to which it is subscribed, the
* broker will not publish the message back to the
Expand Down

0 comments on commit 3ad7808

Please sign in to comment.