Fix bridges incorrectly setting Wills to manage remote notifications.

This is for when `notifications_local_only` was set true.

Closes #1902. Thanks to marcinkowskip.
pull/1920/head
Roger A. Light 5 years ago
parent 7d05f70fe1
commit 0c22f475ff

@ -94,6 +94,8 @@ Broker:
- Add `ciphers_tls1.3` option, to allow setting TLS v1.3 ciphersuites. - Add `ciphers_tls1.3` option, to allow setting TLS v1.3 ciphersuites.
Closes #1825. Closes #1825.
- Report an error if the config file is set to a directory. Closes #1814. - Report an error if the config file is set to a directory. Closes #1814.
- Fix bridges incorrectly setting Wills to manage remote notifications when
`notifications_local_only` was set true. Closes #1902.
Client library: Client library:
- Client no longer generates random client ids for v3.1.1 clients, these are - Client no longer generates random client ids for v3.1.1 clients, these are

@ -100,7 +100,11 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session
}else{ }else{
payloadlen = 2U; payloadlen = 2U;
} }
#ifdef WITH_BROKER
if(mosq->will && (mosq->bridge == NULL || mosq->bridge->notifications_local_only == false)){
#else
if(mosq->will){ if(mosq->will){
#endif
will = 1; will = 1;
assert(mosq->will->msg.topic); assert(mosq->will->msg.topic);

@ -376,12 +376,10 @@ int bridge__connect(struct mosquitto *context)
context->bridge->initial_notification_done = true; context->bridge->initial_notification_done = true;
} }
if (!context->bridge->notifications_local_only) { notification_payload = '0';
notification_payload = '0'; rc = will__set(context, context->bridge->notification_topic, 1, &notification_payload, 1, true, NULL);
rc = will__set(context, context->bridge->notification_topic, 1, &notification_payload, 1, true, NULL); if(rc != MOSQ_ERR_SUCCESS){
if(rc != MOSQ_ERR_SUCCESS){ return rc;
return rc;
}
} }
}else{ }else{
notification_topic_len = strlen(context->bridge->remote_clientid)+strlen("$SYS/broker/connection//state"); notification_topic_len = strlen(context->bridge->remote_clientid)+strlen("$SYS/broker/connection//state");
@ -396,13 +394,11 @@ int bridge__connect(struct mosquitto *context)
context->bridge->initial_notification_done = true; context->bridge->initial_notification_done = true;
} }
if (!context->bridge->notifications_local_only) { notification_payload = '0';
notification_payload = '0'; rc = will__set(context, notification_topic, 1, &notification_payload, 1, true, NULL);
rc = will__set(context, notification_topic, 1, &notification_payload, 1, true, NULL); if(rc != MOSQ_ERR_SUCCESS){
if(rc != MOSQ_ERR_SUCCESS){ mosquitto__free(notification_topic);
mosquitto__free(notification_topic); return rc;
return rc;
}
} }
mosquitto__free(notification_topic); mosquitto__free(notification_topic);
} }

Loading…
Cancel
Save