Fix handling of outgoing QoS>0 messages for bridges.

Fix handling of outgoing QoS>0 messages for bridges that could not be
sent because the bridge connection was down.
pull/211/merge
Roger A. Light 10 years ago
parent 343e833fd9
commit e49e398eb3

@ -3,6 +3,8 @@ Broker:
- Build fixes for OpenBSD.
- Fix incorrect behaviour for autosave_interval, most noticable for
autosave_interval=1. Closes #465438.
- Fix handling of outgoing QoS>0 messages for bridges that could not be sent
because the bridge connection was down.
Client library:
- Add missing error strings to mosquitto_strerror.

@ -195,6 +195,9 @@ void mosquitto__db_msg_store_deref(struct mosquitto_db *db, struct mosquitto_msg
static void _message_remove(struct mosquitto_db *db, struct mosquitto *context, struct mosquitto_client_msg **msg, struct mosquitto_client_msg *last)
{
int i;
struct mosquitto_client_msg *tail;
if(!context || !msg || !(*msg)){
return;
}
@ -223,6 +226,29 @@ static void _message_remove(struct mosquitto_db *db, struct mosquitto *context,
}else{
*msg = context->msgs;
}
tail = context->msgs;
i = 0;
while(tail && tail->state == mosq_ms_queued && i<max_inflight){
if(tail->direction == mosq_md_out){
switch(tail->qos){
case 0:
tail->state = mosq_ms_publish_qos0;
break;
case 1:
tail->state = mosq_ms_publish_qos1;
break;
case 2:
tail->state = mosq_ms_publish_qos2;
break;
}
}else{
if(tail->qos == 2){
tail->state = mosq_ms_send_pubrec;
}
}
tail = tail->next;
}
}
int mqtt3_db_message_delete(struct mosquitto_db *db, struct mosquitto *context, uint16_t mid, enum mosquitto_msg_direction dir)

Loading…
Cancel
Save