mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-06 02:27:15 +00:00
Simplify testing minimum priority in tcp_kill_prio()
Simplify the code a bit by setting mprio = LWIP_MIN(TCP_PRIO_MAX, prio) before the for loop. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
c730e45f0c
commit
f971fb921e
@ -1331,14 +1331,13 @@ tcp_kill_prio(u8_t prio)
|
||||
u32_t inactivity;
|
||||
u8_t mprio;
|
||||
|
||||
mprio = TCP_PRIO_MAX;
|
||||
mprio = LWIP_MIN(TCP_PRIO_MAX, prio);
|
||||
|
||||
/* We kill the oldest active connection that has lower priority than prio. */
|
||||
inactivity = 0;
|
||||
inactive = NULL;
|
||||
for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
if (pcb->prio <= prio &&
|
||||
pcb->prio <= mprio &&
|
||||
if (pcb->prio <= mprio &&
|
||||
(u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
||||
inactivity = tcp_ticks - pcb->tmr;
|
||||
inactive = pcb;
|
||||
|
Loading…
Reference in New Issue
Block a user