@ -149,11 +149,14 @@ int bridge__connect(struct mosquitto_db *db, struct mosquitto *context)
db__messages_easy_queue ( db , context , context - > bridge - > notification_topic , 1 , 1 , & notification_payload , 1 ) ;
context - > bridge - > initial_notification_done = true ;
}
if ( ! context - > bridge - > notifications_local_only ) {
notification_payload = ' 0 ' ;
rc = will__set ( context , context - > bridge - > notification_topic , 1 , & notification_payload , 1 , true ) ;
if ( rc ! = MOSQ_ERR_SUCCESS ) {
return rc ;
}
}
} else {
notification_topic_len = strlen ( context - > bridge - > remote_clientid ) + strlen ( " $SYS/broker/connection//state " ) ;
notification_topic = mosquitto__malloc ( sizeof ( char ) * ( notification_topic_len + 1 ) ) ;
@ -167,6 +170,7 @@ int bridge__connect(struct mosquitto_db *db, struct mosquitto *context)
context - > bridge - > initial_notification_done = true ;
}
if ( ! context - > bridge - > notifications_local_only ) {
notification_payload = ' 0 ' ;
rc = will__set ( context , notification_topic , 1 , & notification_payload , 1 , true ) ;
mosquitto__free ( notification_topic ) ;
@ -175,6 +179,7 @@ int bridge__connect(struct mosquitto_db *db, struct mosquitto *context)
}
}
}
}
log__printf ( NULL , MOSQ_LOG_NOTICE , " Connecting bridge %s (%s:%d) " , context - > bridge - > name , context - > bridge - > addresses [ context - > bridge - > cur_address ] . address , context - > bridge - > addresses [ context - > bridge - > cur_address ] . port ) ;
rc = net__socket_connect ( context , context - > bridge - > addresses [ context - > bridge - > cur_address ] . address , context - > bridge - > addresses [ context - > bridge - > cur_address ] . port , NULL , false ) ;