Fix bridges incorrectly setting Wills to manage remote notifications.
This is for when `notifications_local_only` was set true. Closes #1902. Thanks to marcinkowskip.
This commit is contained in:
parent
7d05f70fe1
commit
0c22f475ff
@ -94,6 +94,8 @@ Broker:
|
||||
- Add `ciphers_tls1.3` option, to allow setting TLS v1.3 ciphersuites.
|
||||
Closes #1825.
|
||||
- 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 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{
|
||||
payloadlen = 2U;
|
||||
}
|
||||
#ifdef WITH_BROKER
|
||||
if(mosq->will && (mosq->bridge == NULL || mosq->bridge->notifications_local_only == false)){
|
||||
#else
|
||||
if(mosq->will){
|
||||
#endif
|
||||
will = 1;
|
||||
assert(mosq->will->msg.topic);
|
||||
|
||||
|
22
src/bridge.c
22
src/bridge.c
@ -376,12 +376,10 @@ int bridge__connect(struct mosquitto *context)
|
||||
context->bridge->initial_notification_done = true;
|
||||
}
|
||||
|
||||
if (!context->bridge->notifications_local_only) {
|
||||
notification_payload = '0';
|
||||
rc = will__set(context, context->bridge->notification_topic, 1, ¬ification_payload, 1, true, NULL);
|
||||
if(rc != MOSQ_ERR_SUCCESS){
|
||||
return rc;
|
||||
}
|
||||
notification_payload = '0';
|
||||
rc = will__set(context, context->bridge->notification_topic, 1, ¬ification_payload, 1, true, NULL);
|
||||
if(rc != MOSQ_ERR_SUCCESS){
|
||||
return rc;
|
||||
}
|
||||
}else{
|
||||
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;
|
||||
}
|
||||
|
||||
if (!context->bridge->notifications_local_only) {
|
||||
notification_payload = '0';
|
||||
rc = will__set(context, notification_topic, 1, ¬ification_payload, 1, true, NULL);
|
||||
if(rc != MOSQ_ERR_SUCCESS){
|
||||
mosquitto__free(notification_topic);
|
||||
return rc;
|
||||
}
|
||||
notification_payload = '0';
|
||||
rc = will__set(context, notification_topic, 1, ¬ification_payload, 1, true, NULL);
|
||||
if(rc != MOSQ_ERR_SUCCESS){
|
||||
mosquitto__free(notification_topic);
|
||||
return rc;
|
||||
}
|
||||
mosquitto__free(notification_topic);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user