mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
mqtt: Do not attempt validating topics if they are not set
Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
This commit is contained in:
parent
30a969c5bc
commit
250d016a98
1 changed files with 12 additions and 8 deletions
|
@ -246,15 +246,19 @@ int villas::node::mqtt_check(NodeCompat *n) {
|
|||
int ret;
|
||||
auto *m = n->getData<struct mqtt>();
|
||||
|
||||
ret = mosquitto_sub_topic_check(m->subscribe);
|
||||
if (ret != MOSQ_ERR_SUCCESS)
|
||||
throw RuntimeError("Invalid subscribe topic: '{}': {}", m->subscribe,
|
||||
mosquitto_strerror(ret));
|
||||
if (m->subscribe) {
|
||||
ret = mosquitto_sub_topic_check(m->subscribe);
|
||||
if (ret != MOSQ_ERR_SUCCESS)
|
||||
throw RuntimeError("Invalid subscribe topic: '{}': {}", m->subscribe,
|
||||
mosquitto_strerror(ret));
|
||||
}
|
||||
|
||||
ret = mosquitto_pub_topic_check(m->publish);
|
||||
if (ret != MOSQ_ERR_SUCCESS)
|
||||
throw RuntimeError("Invalid publish topic: '{}': {}", m->publish,
|
||||
mosquitto_strerror(ret));
|
||||
if (m->publish) {
|
||||
ret = mosquitto_pub_topic_check(m->publish);
|
||||
if (ret != MOSQ_ERR_SUCCESS)
|
||||
throw RuntimeError("Invalid publish topic: '{}': {}", m->publish,
|
||||
mosquitto_strerror(ret));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue