@@ -4100,36 +4100,8 @@ QuicTestHandshakeSpecificLossPatterns(
4100
4100
}
4101
4101
}
4102
4102
4103
- struct ServerMultiAcceptContext {
4104
- uint32_t StartedConnectionCount;
4105
- uint32_t MaxConnections;
4106
- CxPlatEvent StartedEvent;
4107
- UniquePtr<TestConnection>* Connections;
4108
-
4109
- _Function_class_ (NEW_CONNECTION_CALLBACK)
4110
- static
4111
- bool
4112
- ListenerMultiAcceptConnection (
4113
- _In_ TestListener* Listener,
4114
- _In_ HQUIC ConnectionHandle
4115
- )
4116
- {
4117
- auto * This = (ServerMultiAcceptContext*)Listener->Context ;
4118
- uint32_t NewCount = (uint32_t )InterlockedIncrement ((long *)&This->StartedConnectionCount );
4119
- if (NewCount > This->MaxConnections ) {
4120
- TEST_FAILURE (" Too many connections started!" );
4121
- return false ;
4122
- }
4123
- This->Connections [NewCount - 1 ] =
4124
- UniquePtr<TestConnection>(new (std::nothrow) TestConnection (ConnectionHandle, nullptr ));
4125
- if (This->StartedConnectionCount == This->MaxConnections ) {
4126
- This->StartedEvent .Set ();
4127
- }
4128
- return true ;
4129
- }
4130
- };
4131
-
4132
4103
struct ConnectionPoolConnectionContext {
4104
+ CxPlatEvent ConnectedEvent;
4133
4105
uint16_t IdealProcessor;
4134
4106
uint16_t PartitionIndex;
4135
4107
bool Connected;
@@ -4139,6 +4111,7 @@ struct ConnectionPoolConnectionContext {
4139
4111
switch (Event->Type ) {
4140
4112
case QUIC_CONNECTION_EVENT_CONNECTED:
4141
4113
This->Connected = true ;
4114
+ This->ConnectedEvent .Set ();
4142
4115
break ;
4143
4116
case QUIC_CONNECTION_EVENT_IDEAL_PROCESSOR_CHANGED:
4144
4117
This->IdealProcessor = Event->IDEAL_PROCESSOR_CHANGED .IdealProcessor ;
@@ -4169,7 +4142,7 @@ QuicTestConnectionPoolCreate(
4169
4142
MsQuicAlpn Alpn (" MsQuicTest" );
4170
4143
4171
4144
MsQuicSettings Settings;
4172
- Settings.SetIdleTimeoutMs (1000 );
4145
+ Settings.SetIdleTimeoutMs (TestWaitTimeout );
4173
4146
Settings.SetPeerBidiStreamCount (1 );
4174
4147
4175
4148
MsQuicConfiguration ServerConfiguration (Registration, Alpn, Settings, ServerSelfSignedCredConfig);
@@ -4181,16 +4154,9 @@ QuicTestConnectionPoolCreate(
4181
4154
QuicAddr ServerAddr (QuicAddrFamily);
4182
4155
if (XdpSupported) {
4183
4156
QuicAddrSetToDuoNic (&ServerAddr.SockAddr );
4184
- } else {
4185
- QuicAddrSetToLoopback (&ServerAddr.SockAddr );
4186
4157
}
4187
- const uint16_t ServerPort = 4433 ;
4188
- ServerAddr.SetPort (ServerPort);
4189
4158
4190
4159
{
4191
- UniquePtrArray<UniquePtr<TestConnection>> ServerConnections (new (std::nothrow) UniquePtr<TestConnection>[NumberOfConnections]);
4192
- TEST_NOT_EQUAL (nullptr , ServerConnections);
4193
-
4194
4160
UniquePtrArray<ConnectionScope> Connections (new (std::nothrow) ConnectionScope[NumberOfConnections]);
4195
4161
TEST_NOT_EQUAL (nullptr , Connections);
4196
4162
@@ -4207,14 +4173,15 @@ QuicTestConnectionPoolCreate(
4207
4173
Contexts[i].PartitionIndex = 0 ;
4208
4174
}
4209
4175
4210
- ServerMultiAcceptContext ServerAcceptContext {};
4211
- ServerAcceptContext.MaxConnections = NumberOfConnections;
4212
- ServerAcceptContext.Connections = ServerConnections.get ();
4213
- ServerAcceptContext.StartedConnectionCount = 0 ;
4214
- TestListener Listener (Registration, ServerMultiAcceptContext::ListenerMultiAcceptConnection, ServerConfiguration);
4215
- TEST_TRUE (Listener.IsValid ());
4216
- Listener.Context = &ServerAcceptContext;
4217
- TEST_QUIC_SUCCEEDED (Listener.Start (Alpn, &ServerAddr.SockAddr ));
4176
+ MsQuicAutoAcceptListener Listener (Registration, ServerConfiguration, MsQuicConnection::NoOpCallback);
4177
+ TEST_QUIC_SUCCEEDED (Listener.GetInitStatus ());
4178
+
4179
+ if (TestCibirSupport) {
4180
+ TEST_QUIC_SUCCEEDED (Listener.SetCibirId (CibirId, CibirIdLength));
4181
+ }
4182
+
4183
+ TEST_QUIC_SUCCEEDED (Listener.Start (Alpn, ServerAddr));
4184
+ TEST_QUIC_SUCCEEDED (Listener.GetLocalAddr (ServerAddr));
4218
4185
4219
4186
{
4220
4187
UniquePtrArray<uint8_t *> CibirIdPtrs (new (std::nothrow) uint8_t *[NumberOfConnections]);
@@ -4229,7 +4196,7 @@ QuicTestConnectionPoolCreate(
4229
4196
if (XdpSupported) {
4230
4197
PoolConfig.ServerAddress = &ServerAddr.SockAddr ;
4231
4198
}
4232
- PoolConfig.ServerPort = ServerPort ;
4199
+ PoolConfig.ServerPort = ServerAddr. GetPort () ;
4233
4200
PoolConfig.Context = (void **)ContextPtrs.get ();
4234
4201
PoolConfig.Family = QuicAddrFamily;
4235
4202
PoolConfig.NumberOfConnections = NumberOfConnections;
@@ -4238,7 +4205,6 @@ QuicTestConnectionPoolCreate(
4238
4205
if (TestCibirSupport) {
4239
4206
for (uint32_t i = 0 ; i < NumberOfConnections; i++) {
4240
4207
CxPlatCopyMemory (&(CibirIdBuffer[i * CibirIdLength]), CibirId, CibirIdLength);
4241
- CibirIdBuffer[(i * CibirIdLength) + (CibirIdLength - 1 )] += (uint8_t )i;
4242
4208
CibirIdPtrs[i] = &CibirIdBuffer[i * CibirIdLength];
4243
4209
}
4244
4210
PoolConfig.CibirIds = CibirIdPtrs.get ();
@@ -4248,22 +4214,16 @@ QuicTestConnectionPoolCreate(
4248
4214
QUIC_STATUS Status = MsQuic->ConnectionPoolCreate (&PoolConfig, &(Connections.get ()->Handle ));
4249
4215
if (XdpSupported) {
4250
4216
TEST_QUIC_SUCCEEDED (Status);
4251
- ServerAcceptContext.StartedEvent .WaitForever ();
4252
4217
for (uint32_t i = 0 ; i < NumberOfConnections; i++) {
4253
- //
4254
- // Verify the server connections are connected. The client connections should also be connected too.
4255
- //
4256
- ServerConnections[i]->WaitForConnectionComplete ();
4257
- if (!ServerConnections[i]->GetIsConnected ()) {
4258
- TEST_FAILURE (" Server connection %u failed to connect" , i);
4259
- }
4260
4218
//
4261
4219
// Verify the client connection is connected.
4262
4220
//
4221
+ Contexts[i].ConnectedEvent .WaitTimeout (TestWaitTimeout);
4263
4222
if (!Contexts[i].Connected ) {
4264
4223
TEST_FAILURE (" Client connection %u failed to connect" , i);
4265
4224
}
4266
4225
}
4226
+ TEST_EQUAL (NumberOfConnections, Listener.AcceptedConnectionCount );
4267
4227
} else {
4268
4228
//
4269
4229
// When testing no XDP support, the loopback address is used,
0 commit comments