This commit is contained in:
Nick Banks 2020-05-15 07:43:47 -07:00 коммит произвёл GitHub
Родитель 4bfba82b82
Коммит d20a6c59bc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 56 добавлений и 6 удалений

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

@ -30,12 +30,12 @@ jobs:
- task: PowerShell@2
displayName: Run SpinQuic
timeoutInMinutes: 10
timeoutInMinutes: 12
continueOnError: true
inputs:
pwsh: true
filePath: scripts/spin.ps1
arguments: -GenerateXmlResults -Timeout 300000 -LogProfile SpinQuic.Light -ConvertLogs -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }}
arguments: -GenerateXmlResults -Timeout 600000 -LogProfile SpinQuic.Light -ConvertLogs -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }}
- template: ./upload-test-artifacts.yml
parameters:

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

@ -266,7 +266,6 @@ QuicStreamClose(
{
if (!Stream->Flags.ShutdownComplete) {
QUIC_CONN_VERIFY(Stream->Connection, !Stream->Flags.Started);
if (Stream->Flags.Started) {
//
// TODO - If the stream hasn't been aborted already, then this is a

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

@ -128,7 +128,6 @@ QuicStreamSendShutdown(
goto Exit;
}
QUIC_CONN_VERIFY(Stream->Connection, ApiSendRequests == NULL);
while (ApiSendRequests != NULL) {
//
// These sends were queued by the app after queueing a graceful

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

@ -6,7 +6,7 @@
<Buffers Value="20"/>
</SystemCollector>
<EventCollector Id="EC_LowVolume" Name="LowVolume">
<BufferSize Value="32"/>
<BufferSize Value="16"/>
<Buffers Value="32"/>
</EventCollector>
<EventCollector Id="EC_HighVolume" Name="High Volume">

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

@ -200,6 +200,7 @@ static struct {
const char* AlpnPrefix;
std::vector<uint16_t> Ports;
const char* ServerName;
uint8_t LossPercent;
} Settings;
extern "C" void QuicTraceRundown(void) { }
@ -374,7 +375,7 @@ void Spin(LockableVector<HQUIC>& Connections, bool IsServer)
}
switch (GetRandom(SpinQuicAPICallCount)) {
case SpinQuicAPICallCreateConnection :
case SpinQuicAPICallCreateConnection:
if (!IsServer) {
auto ctx = new SpinQuicConnection();
if (ctx == nullptr) continue;
@ -614,12 +615,29 @@ QUIC_THREAD_CALLBACK(ClientSpin, Context)
QUIC_THREAD_RETURN(0);
}
BOOLEAN QUIC_API DatapathHookReceiveCallback(struct QUIC_RECV_DATAGRAM* /* Datagram */)
{
uint8_t RandomValue;
QuicRandom(sizeof(RandomValue), &RandomValue);
return (RandomValue % 100) < Settings.LossPercent;
}
BOOLEAN QUIC_API DatapathHookSendCallback(QUIC_ADDR* /* RemoteAddress */, QUIC_ADDR* /* LocalAddress */, struct QUIC_DATAPATH_SEND_CONTEXT* /* SendContext */)
{
return FALSE; // Don't drop
}
QUIC_TEST_DATAPATH_HOOKS DataPathHooks = {
DatapathHookReceiveCallback, DatapathHookSendCallback
};
void PrintHelpText(void)
{
printf("Usage: spinquic.exe [client/server/both] [options]\n" \
"\n" \
" -alpn:<alpn> default: 'spin'\n" \
" -dstport:<port> default: 9999\n" \
" -loss:<percent> default: 1\n" \
" -max_ops:<count> default: UINT64_MAX\n"
" -seed:<seed> default: 6\n" \
" -sessions:<count> default: 4\n" \
@ -662,9 +680,11 @@ main(int argc, char **argv)
Settings.Ports = std::vector<uint16_t>({9998, 9999});
Settings.AlpnPrefix = "spin";
Settings.MaxOperationCount = UINT64_MAX;
Settings.LossPercent = 1;
TryGetValue(argc, argv, "timeout", &Settings.RunTimeMs);
TryGetValue(argc, argv, "max_ops", &Settings.MaxOperationCount);
TryGetValue(argc, argv, "loss", &Settings.LossPercent);
if (RunClient) {
uint16_t dstPort = 0;
@ -684,6 +704,17 @@ main(int argc, char **argv)
EXIT_ON_FAILURE(MsQuicOpen(&MsQuic));
if (Settings.LossPercent != 0) {
QUIC_TEST_DATAPATH_HOOKS* Value = &DataPathHooks;
EXIT_ON_FAILURE(
MsQuic->SetParam(
nullptr,
QUIC_PARAM_LEVEL_GLOBAL,
QUIC_PARAM_GLOBAL_TEST_DATAPATH_HOOKS,
sizeof(Value),
&Value));
}
const QUIC_REGISTRATION_CONFIG RegConfig = { "spinquic", QUIC_EXECUTION_PROFILE_LOW_LATENCY };
EXIT_ON_FAILURE(MsQuic->RegistrationOpen(&RegConfig, &Registration));
@ -761,6 +792,27 @@ main(int argc, char **argv)
MsQuic->RegistrationClose(Registration);
if (Settings.LossPercent != 0) {
QUIC_TEST_DATAPATH_HOOKS* Value = nullptr;
uint32_t TryCount = 0;
while (TryCount++ < 10) {
if (QUIC_SUCCEEDED(
MsQuic->SetParam(
nullptr,
QUIC_PARAM_LEVEL_GLOBAL,
QUIC_PARAM_GLOBAL_TEST_DATAPATH_HOOKS,
sizeof(Value),
&Value))) {
break;
}
QuicSleep(100); // Let the current datapath queue drain.
}
if (TryCount == 10) {
printf("Failed to disable test datapath hook!\n");
QUIC_FRE_ASSERTMSG(FALSE, "Failed to disable test datapath hook!");
}
}
MsQuicClose(MsQuic);
return 0;