mosquitto_pub now handles the MQTT v5 retain-available property

It will not set the retain bit if retain-available is false.
pull/1522/head
Roger A. Light 6 years ago
parent 9cdc822a19
commit 88c83fe6b5

@ -15,6 +15,8 @@ Client library:
identifier integer to the corresponding property name string.
- Add `mosquitto_property_next()` to retrieve the next property in a list, for
iterating over property lists.
- mosquitto_pub now handles the MQTT v5 retain-available property by never
setting the retain bit.
Clients:
- Add timeout return code (27) for `mosquitto_sub -W <secs>` and

@ -51,6 +51,10 @@ int mosquitto_publish_v5(struct mosquitto *mosq, int *mid, const char *topic, in
if(mosq->protocol != mosq_p_mqtt5 && properties) return MOSQ_ERR_NOT_SUPPORTED;
if(qos > mosq->maximum_qos) return MOSQ_ERR_QOS_NOT_SUPPORTED;
if(!mosq->retain_available){
retain = false;
}
if(properties){
if(properties->client_generated){
outgoing_properties = properties;

@ -78,6 +78,7 @@ static int mosquitto__connect_init(struct mosquitto *mosq, const char *host, int
mosq->keepalive = keepalive;
mosq->msgs_in.inflight_quota = mosq->msgs_in.inflight_maximum;
mosq->msgs_out.inflight_quota = mosq->msgs_out.inflight_maximum;
mosq->retain_available = 1;
if(mosq->sockpairR != INVALID_SOCKET){
COMPAT_CLOSE(mosq->sockpairR);

@ -97,6 +97,7 @@ int handle__connack(struct mosquitto *mosq)
}
}
mosquitto_property_read_byte(properties, MQTT_PROP_RETAIN_AVAILABLE, &mosq->retain_available, false);
mosquitto_property_read_byte(properties, MQTT_PROP_MAXIMUM_QOS, &mosq->maximum_qos, false);
mosquitto_property_read_int16(properties, MQTT_PROP_RECEIVE_MAXIMUM, &mosq->msgs_out.inflight_maximum, false);
mosquitto_property_read_int16(properties, MQTT_PROP_SERVER_KEEP_ALIVE, &mosq->keepalive, false);

@ -329,6 +329,7 @@ struct mosquitto {
unsigned int reconnect_delay;
unsigned int reconnect_delay_max;
bool reconnect_exponential_backoff;
uint8_t retain_available;
char threaded;
struct mosquitto__packet *out_packet_last;
# ifdef WITH_SRV

Loading…
Cancel
Save