Another bridge notification fix.

pull/211/merge
Roger A. Light 11 years ago
parent 1fdc4ceee6
commit ef573448f4

@ -52,11 +52,11 @@ int mqtt3_handle_connack(struct mosquitto_db *db, struct mosquitto *context)
} }
mqtt3_db_messages_easy_queue(db, context, context->bridge->notification_topic, 1, 1, &notification_payload, 1); mqtt3_db_messages_easy_queue(db, context, context->bridge->notification_topic, 1, 1, &notification_payload, 1);
}else{ }else{
notification_topic_len = strlen(context->id)+strlen("$SYS/broker/connection//state"); notification_topic_len = strlen(context->bridge->remote_clientid)+strlen("$SYS/broker/connection//state");
notification_topic = _mosquitto_malloc(sizeof(char)*(notification_topic_len+1)); notification_topic = _mosquitto_malloc(sizeof(char)*(notification_topic_len+1));
if(!notification_topic) return MOSQ_ERR_NOMEM; if(!notification_topic) return MOSQ_ERR_NOMEM;
snprintf(notification_topic, notification_topic_len+1, "$SYS/broker/connection/%s/state", context->id); snprintf(notification_topic, notification_topic_len+1, "$SYS/broker/connection/%s/state", context->bridge->remote_clientid);
notification_payload = '1'; notification_payload = '1';
if(_mosquitto_send_real_publish(context, _mosquitto_mid_generate(context), if(_mosquitto_send_real_publish(context, _mosquitto_mid_generate(context),
notification_topic, 1, &notification_payload, 1, true, 0)){ notification_topic, 1, &notification_payload, 1, true, 0)){

Loading…
Cancel
Save