Add a boost factor to estimate send.ratemax
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
4
mud.c
4
mud.c
@@ -528,6 +528,7 @@ mud_reset_path(struct mud *mud, struct mud_path *path)
|
||||
path->mtu.max = MUD_MTU_MAX;
|
||||
path->mtu.count = 0;
|
||||
path->send.ratemax = 0;
|
||||
path->send_factor = 8;
|
||||
path->window = 0;
|
||||
path->ok = 0;
|
||||
path->stat_count = 0;
|
||||
@@ -1237,7 +1238,7 @@ mud_packet_recv(struct mud *mud, struct mud_path *path,
|
||||
const uint64_t b = (path->send.ratemax ?: 5000) * target;
|
||||
|
||||
if (dt < target) {
|
||||
uint64_t delta = ((target - dt) * a) / b;
|
||||
uint64_t delta = ((target - dt) * a * path->send_factor) / b;
|
||||
path->send.ratemax += delta;
|
||||
} else if (dt > target) {
|
||||
uint64_t delta = ((dt - target) * a) / b;
|
||||
@@ -1248,6 +1249,7 @@ mud_packet_recv(struct mud *mud, struct mud_path *path,
|
||||
}
|
||||
if (path->send.ratemax < 5000)
|
||||
path->send.ratemax = 5000;
|
||||
path->send_factor = 1;
|
||||
}
|
||||
|
||||
return !!peer_sent;
|
||||
|
||||
Reference in New Issue
Block a user