Attention is currently required from: arehbein, dexter, pespin.
Patch set 1:Code-Review -1
1 comment:
File src/core/write_queue.c:
Patch Set #1, Line 163: dropped_msgs < diff
Imagine the following situation: the user wants to reduce the queue limit (`max_length`) from 128 to 64. The queue contains 32 items (`current_length`).
```
int diff = queue->max_length - len; // 128 - 64 == 64
queue->max_length = len; // 64
for (dropped_msgs = 0; dropped_msgs < 64 && !llist_empty(q); dropped_msgs++)
```
so IIUC, this function would dequeue and free these 32 items, despite their count does not exceed the new limit (64). This looks wrong to me. Another problem is that you're not updating the `current_length` in this function at all.
I suggest the following:
```
while (queue->current_length > queue->max_length) {
msg = msgb_dequeue_count(&queue->msg_queue, &queue->current_length);
msgb_free(msg);
dropped_msgs++;
}
```
To view, visit change 34444. To unsubscribe, or for help writing mail filters, visit settings.