Fix --remove-retained not obeying the -T option.

This means `--remove-retained -t bbc/# -T bbc/one/#` would remove all
retained messages in `bbc/#`, instead of leaving all of the topics in
`bbc/one/#`.

Closes #1585. Thanks to Simon Moser.
This commit is contained in:
Roger A. Light 2020-02-05 15:19:55 +00:00
parent 3a89059271
commit 56d0b950ac
2 changed files with 9 additions and 5 deletions

View File

@ -14,10 +14,14 @@ Broker:
- Print OpenSSL errors in more situations, like when loading certificates
fails. Closes #1552.
Library:
Client library:
- Set minimum keepalive argument to `mosquitto_connect*()` to be 5 seconds.
Closes #1550.
Clients:
- Fix `--remove-retained` not obeying the `-T` option for filtering out
topics. Closes #1585.
1.6.8 - 20191128
================

View File

@ -76,10 +76,6 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
if(process_messages == false) return;
if(cfg.remove_retained && message->retain){
mosquitto_publish(mosq, &last_mid, message->topic, 0, NULL, 1, true);
}
if(cfg.retained_only && !message->retain && process_messages){
process_messages = false;
if(last_mid == 0){
@ -96,6 +92,10 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
}
}
if(cfg.remove_retained && message->retain){
mosquitto_publish(mosq, &last_mid, message->topic, 0, NULL, 1, true);
}
print_message(&cfg, message);
if(cfg.msg_count>0){