Skip to content

Commit

Permalink
Fix more incorrect quota handling.
Browse files Browse the repository at this point in the history
Must check QoS, and directions were wrong.
  • Loading branch information
ralight committed Nov 2, 2020
1 parent 042c273 commit 1191a42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ int db__message_reconnect_reset_outgoing(struct mosquitto_db *db, struct mosquit
if(msg->qos > 0){
context->msgs_out.msg_count12++;
context->msgs_out.msg_bytes12 += msg->store->payloadlen;
util__decrement_receive_quota(context);
util__decrement_send_quota(context);
}

switch(msg->qos){
Expand Down Expand Up @@ -954,7 +954,9 @@ int db__message_write_inflight_in(struct mosquitto_db *db, struct mosquitto *con
if(now > tail->store->message_expiry_time){
/* Message is expired, must not send. */
db__message_remove(db, &context->msgs_in, tail);
util__decrement_send_quota(context);
if(tail->qos > 0){
util__increment_receive_quota(context);
}
continue;
}
}
Expand Down

0 comments on commit 1191a42

Please sign in to comment.