Skip to content

db__message_insert decrements inflight quota although message was queued #2306

Closed
@canique

Description

@canique

db__message_insert() in database.c calls util__decrement_send_quota with the wrong conditions.

Let's look at an example:
Conditions:
we have a valid socket, we have send msg quota left, we have no bytes quota left, QoS=1

db__ready_for_flight() returns false because no bytes quota left, hence the msg is queued.

Later we have the check (before decrementing the send msg quota)

if(dir == mosq_md_out && msg->qos > 0){
util__decrement_send_quota(context);
}

This will evaluate to true, but the msg was not ready for flight so why reduce the inflight quota?

Correct would be:

//state must be mosq_ms_publish_qos1 || mosq_ms_publish_qos2
if(dir == mosq_md_out && msg->qos > 0 && state != mosq_ms_queued){ 
util__decrement_send_quota(context);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: mosquitto-brokerStatus: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions