fix: apply lb settings after lb mode change (#4036)

Fixing an issue where the CID prefix
lengths (MsQuicLib.CidServerIdLength and MsQuicLib.CidTotalLength)
weren't being updated properly when transitioning the lb mode from its
default state (disabled) to QUIC_LOAD_BALANCING_SERVER_ID_IP. This
resulted in the server source CIDs not being prefixed with the source IP
This commit is contained in:
William Yang 2024-01-04 12:47:36 +01:00 коммит произвёл GitHub
Родитель 8faef0db35
Коммит d7a3658cea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -856,6 +856,9 @@ QuicLibrarySetGlobalParam(
MsQuicLib.Settings.LoadBalancingMode = *(uint16_t*)Buffer;
MsQuicLib.Settings.IsSet.LoadBalancingMode = TRUE;
QuicLibApplyLoadBalancingSetting();
QuicTraceLogInfo(
LibraryLoadBalancingModeSet,
"[ lib] Updated load balancing mode = %hu",

Просмотреть файл

@ -525,6 +525,31 @@ TEST(SettingsTest, GlobalSettingsSizesSet)
}
}
TEST(SettingsTest, GlobalLoadBalancingServerIDSet)
{
uint16_t Mode = QUIC_LOAD_BALANCING_SERVER_ID_IP;
uint16_t OldMode = MsQuicLib.Settings.LoadBalancingMode;
ASSERT_EQ(
QUIC_STATUS_SUCCESS,
QuicLibrarySetGlobalParam(
QUIC_PARAM_GLOBAL_LOAD_BALACING_MODE,
sizeof(Mode),
&Mode));
ASSERT_EQ(Mode, MsQuicLib.Settings.LoadBalancingMode);
ASSERT_EQ(5, MsQuicLib.CidServerIdLength);
ASSERT_EQ(QUIC_CID_PID_LENGTH + QUIC_CID_PAYLOAD_LENGTH + 5, MsQuicLib.CidTotalLength);
// Revert
ASSERT_EQ(
QUIC_STATUS_SUCCESS,
QuicLibrarySetGlobalParam(
QUIC_PARAM_GLOBAL_LOAD_BALACING_MODE,
sizeof(OldMode),
&OldMode));
}
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
TEST(SettingsTest, GlobalExecutionConfigSetAndGet)
{