Do not reset bind address option if passed NULL.

mosquitto_connect_bind_async() and mosquitto_connect_bind_v5() should not
reset the bind address option if called with bind_address == NULL.

Otherwise calling mosquitto_connect_async() will *force* the bind
address to be reset, even if previously set with
mosquitto_string_option().
pull/1976/head
Roger A. Light 5 years ago
parent e02b5a2775
commit 2db9aecac4

@ -1,6 +1,8 @@
Broker:
- Fix $SYS/broker/publish/messages/+ counters not being updated for QoS 1, 2
messages. Closes #1968.
- mosquitto_connect_bind_async() and mosquitto_connect_bind_v5() should not
reset the bind address option if called with bind_address == NULL.
2.0.3 - 2020-12-17

@ -96,8 +96,10 @@ int mosquitto_connect_bind_v5(struct mosquitto *mosq, const char *host, int port
{
int rc;
rc = mosquitto_string_option(mosq, MOSQ_OPT_BIND_ADDRESS, bind_address);
if(rc) return rc;
if(bind_address){
rc = mosquitto_string_option(mosq, MOSQ_OPT_BIND_ADDRESS, bind_address);
if(rc) return rc;
}
mosquitto_property_free_all(&mosq->connect_properties);
if(properties){
@ -128,8 +130,10 @@ int mosquitto_connect_bind_async(struct mosquitto *mosq, const char *host, int p
{
int rc;
rc = mosquitto_string_option(mosq, MOSQ_OPT_BIND_ADDRESS, bind_address);
if(rc) return rc;
if(bind_address){
rc = mosquitto_string_option(mosq, MOSQ_OPT_BIND_ADDRESS, bind_address);
if(rc) return rc;
}
rc = mosquitto__connect_init(mosq, host, port, keepalive);
if(rc) return rc;

Loading…
Cancel
Save