Limit tx.rate to tx_max_rate...

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2020-01-04 12:38:14 +00:00
parent 8f11ffa5a4
commit 6894867b9f

2
mud.c
View File

@@ -1193,6 +1193,8 @@ mud_update_window(struct mud *mud, struct mud_path *path, uint64_t now,
{ {
if (rx_dt && rx_dt > tx_dt + (tx_dt >> 3)) { if (rx_dt && rx_dt > tx_dt + (tx_dt >> 3)) {
path->tx.rate = 1 + ((rx_bytes * MUD_ONE_SEC) - 1) / rx_dt; path->tx.rate = 1 + ((rx_bytes * MUD_ONE_SEC) - 1) / rx_dt;
if (path->tx.rate > path->conf.tx_max_rate)
path->tx.rate = path->conf.tx_max_rate;
} else { } else {
uint64_t tx_acc = path->msg.tx.acc + tx_pkt; uint64_t tx_acc = path->msg.tx.acc + tx_pkt;
uint64_t rx_acc = path->msg.rx.acc + rx_pkt; uint64_t rx_acc = path->msg.rx.acc + rx_pkt;