Skip to content
Snippets Groups Projects
Commit 6189e417 authored by Štěpán Balážik's avatar Štěpán Balážik
Browse files

fixup! selection: balance the choice of IPv4/IPv6 servers when RTT cache is clear

parent 641bc796
1 merge request!1142Draft: selection: balance the choice of IPv4/IPv6 servers when RTT cache is clear
Pipeline #77108 failed with stages
in 1 hour, 3 minutes, and 10 seconds
This commit is part of merge request !1142. Comments created here will be created in the context of that merge request.
......@@ -331,7 +331,16 @@ static void shuffle_choices(struct choice choices[], int choices_len)
static void balance_ip_versions(struct choice choices[], int choices_len)
{
size_t versions[2] = {sizeof(struct in_addr), sizeof(struct in6_addr)};
size_t version_len = versions[kr_rand_coin(1,2)];
static int chosen_version = 0;
if (chosen_version == 0) {
chosen_version = kr_rand_coin(1,2)+1;
} else if (chosen_version == 1) {
chosen_version = 2;
} else if (chosen_version == 2) {
chosen_version = 1;
}
int version_len = versions[chosen_version - 1];
for (int i = 0; i < choices_len; i++) {
if (!no_rtt_info(choices[i].address_state->rtt_state)) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment