diff --git a/lib/send_publish.c b/lib/send_publish.c index 4f11d24c..960993fe 100644 --- a/lib/send_publish.c +++ b/lib/send_publish.c @@ -44,10 +44,10 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3 { #ifdef WITH_BROKER size_t len; + int rc; #ifdef WITH_BRIDGE struct mosquitto__bridge_topic *cur_topic; bool match; - int rc; char *mapped_topic = NULL; char *topic_temp = NULL; #endif diff --git a/src/bridge.c b/src/bridge.c index f5b73a7d..092507eb 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -267,17 +267,14 @@ static int bridge__connect_step1(struct mosquitto *context) }else{ qos = cur_topic->qos; } - if(sub__add(context, - cur_topic->local_topic, - qos, - 0, - MQTT_SUB_OPT_NO_LOCAL | MQTT_SUB_OPT_RETAIN_AS_PUBLISHED - ) > 0){ + struct mosquitto_subscription sub; + sub.topic_filter = cur_topic->local_topic; + sub.identifier = 0; + sub.options = MQTT_SUB_OPT_NO_LOCAL | MQTT_SUB_OPT_RETAIN_AS_PUBLISHED | qos; + if(sub__add(context, &sub) > 0){ return 1; } - retain__queue(context, - cur_topic->local_topic, - qos, 0); + retain__queue(context, &sub); } }