Fix message priority implementation
Functional specification mandates returning a message with a higher timestamp in case two messages have the same priority. Somehow we missed this in the implementation. This also introduced a bug where all messages with same priority could cause problems.
This commit is contained in:
parent
fe71ea4bc1
commit
0cc443d3c2
1 changed files with 4 additions and 1 deletions
|
@ -176,7 +176,10 @@ int message_index_with_highprio(int mqdes, endpoint_t dst)
|
|||
prio = mq.msg[mqdes].msge[i].priority;
|
||||
for (int j = 0; j < MAX_RECEIVERS; j++) {
|
||||
if (mq.msg[mqdes].msge[i].dst[j] == dst) {
|
||||
if (max_prio < find_max(max_prio, prio)) {
|
||||
if (max_prio == prio) {
|
||||
if (mq.msg[mqdes].msge[i].timestamp > mq.msg[mqdes].msge[index].timestamp)
|
||||
index = i;
|
||||
} else if (max_prio < find_max(max_prio, prio)) {
|
||||
index = i;
|
||||
max_prio = find_max(max_prio, prio);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue