* FIX [broker] Fix the error in sending msg before encoding.
@@ -192,6 +192,11 @@ bridge_handler(nano_work *work)
work->pub_packet->fixed_header.dup,
work->pub_packet->fixed_header.qos,
work->pub_packet->fixed_header.retain, props);
+ if (work->proto_ver == MQTT_PROTOCOL_VERSION_v5) {
+ nng_mqttv5_msg_encode(smsg);
+ } else {
+ nng_mqtt_msg_encode(smsg);
+ }
for (size_t t = 0; t < work->config->bridge.count; t++) {
conf_bridge_node *node = work->config->bridge.nodes[t];
@@ -215,11 +220,6 @@ bridge_handler(nano_work *work)
}
}
- if (work->proto_ver == MQTT_PROTOCOL_VERSION_v5) {
- nng_mqttv5_msg_encode(smsg);
- } else {
- nng_mqtt_msg_encode(smsg);
- }
nng_msg_free(smsg);
return rv;
}
