mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-21 07:13:46 +08:00
Fix mosquitto_pub -l quitting if broker unavailable.
This could occur when a message publication is attempted when the broker is temporarily unavailable. Closes #2187. Thanks to JsBergbau.
This commit is contained in:
@@ -9,6 +9,8 @@ Broker:
|
||||
Clients:
|
||||
- If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect
|
||||
that the pipe has closed and disconnect. Closes #2164.
|
||||
- Fix `mosquitto_pub -l` quitting if a message publication is attempted when
|
||||
the broker is temporarily unavailable. Closes #2187.
|
||||
|
||||
|
||||
2.0.10 - 2021-04-03
|
||||
|
||||
+3
-5
@@ -268,9 +268,8 @@ static int pub_stdin_line_loop(struct mosquitto *mosq)
|
||||
line_buf[buf_len_actual-1] = '\0';
|
||||
rc = my_publish(mosq, &mid_sent, cfg.topic, buf_len_actual-1, line_buf, cfg.qos, cfg.retain);
|
||||
pos = 0;
|
||||
if(rc){
|
||||
err_printf(&cfg, "Error: Publish returned %d.\n", rc);
|
||||
if(cfg.qos>0) return rc;
|
||||
if(rc != MOSQ_ERR_SUCCESS && rc != MOSQ_ERR_NO_CONN){
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
@@ -288,7 +287,6 @@ static int pub_stdin_line_loop(struct mosquitto *mosq)
|
||||
if(pos != 0){
|
||||
rc = my_publish(mosq, &mid_sent, cfg.topic, buf_len_actual, line_buf, cfg.qos, cfg.retain);
|
||||
if(rc){
|
||||
err_printf(&cfg, "Error: Publish returned %d.\n", rc);
|
||||
if(cfg.qos>0) return rc;
|
||||
}
|
||||
}
|
||||
@@ -357,7 +355,7 @@ static int pub_other_loop(struct mosquitto *mosq)
|
||||
rc = my_publish(mosq, &mid_sent, cfg.topic, 0, NULL, cfg.qos, cfg.retain);
|
||||
break;
|
||||
}
|
||||
if(rc){
|
||||
if(rc != MOSQ_ERR_SUCCESS && rc != MOSQ_ERR_NO_CONN){
|
||||
err_printf(&cfg, "Error sending repeat publish: %s", mosquitto_strerror(rc));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user