Skip to content

Commit 5c019ef

Browse files
committed
Merge branch 'main' into seera-main
2 parents 4653f54 + 43959b6 commit 5c019ef

16 files changed

Lines changed: 823 additions & 799 deletions

docs/Streams.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ There is no guarantee the `QUIC_BUFFER`s indicated in a receive notification wil
167167

168168
The application is responsible for tracking the amount of data received and when a buffer it provided has been fully used.
169169
The application regains full ownership of a buffer after it get a receive notification for all bytes in the buffer and accept them by calling [StreamReceiveComplete](api/StreamReceiveComplete.md).
170+
MsQuic will not re-use a buffer for subsequent receives once it has been fully written, unless the app submits the same buffer again.
170171
If the application accepts all the buffer's bytes **inline** from the receive notification, by returning `QUIC_STATUS_SUCCESS` and setting `TotalBufferLength` appropriately,
171172
it can free or reuse the buffer while in the notification handler.
172173

src/bin/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if(BUILD_SHARED_LIBS)
2020
endif()
2121
else()
2222
add_library(msquic_static STATIC static/empty.c)
23+
set_target_properties(msquic_static PROPERTIES OUTPUT_NAME "${QUIC_LIBRARY_NAME}${CMAKE_DEBUG_POSTFIX}")
2324
target_link_libraries(msquic_static PRIVATE core msquic_platform inc logging main_binary_link_args)
2425
target_compile_definitions(msquic_static PUBLIC QUIC_BUILD_STATIC)
2526
set_property(TARGET msquic_static PROPERTY FOLDER "${QUIC_FOLDER_PREFIX}libraries")

src/core/stream.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,15 @@ QuicStreamSwitchToAppOwnedBuffers(
977977
_In_ QUIC_STREAM* Stream
978978
)
979979
{
980+
//
981+
// Preserve the initial receive window size: it should not have changed
982+
// since the stream's creation.
983+
//
984+
const uint32_t InitialControlFlow = Stream->RecvBuffer.VirtualBufferLength;
985+
CXPLAT_DBG_ASSERT(
986+
InitialControlFlow == Stream->Connection->Settings.StreamRecvWindowBidiRemoteDefault ||
987+
InitialControlFlow == Stream->Connection->Settings.StreamRecvWindowUnidiDefault);
988+
980989
//
981990
// Reset the current receive buffer
982991
//
@@ -988,7 +997,7 @@ QuicStreamSwitchToAppOwnedBuffers(
988997
(void)QuicRecvBufferInitialize(
989998
&Stream->RecvBuffer,
990999
0,
991-
0,
1000+
InitialControlFlow,
9921001
QUIC_RECV_BUF_MODE_APP_OWNED,
9931002
NULL);
9941003
Stream->Flags.UseAppOwnedRecvBuffers = TRUE;

src/platform/datapath_winuser.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,8 +2667,13 @@ CxPlatDataPathSocketProcessAcceptCompletion(
26672667
0,
26682668
"AcceptEx Completed!");
26692669

2670-
2670+
//
2671+
// Mark IO Started before taking a rundown reference,
2672+
// otherwise the cleanup might not wait for the rundown.
2673+
//
2674+
AcceptSocketProc->IoStarted = TRUE;
26712675
if (!CxPlatRundownAcquire(&AcceptSocketProc->RundownRef)) {
2676+
AcceptSocketProc = NULL;
26722677
goto Error;
26732678
}
26742679

@@ -2736,8 +2741,6 @@ CxPlatDataPathSocketProcessAcceptCompletion(
27362741
}
27372742

27382743
ListenerSocketProc->AcceptSocket = NULL;
2739-
2740-
AcceptSocketProc->IoStarted = TRUE;
27412744
CxPlatDataPathStartReceiveAsync(AcceptSocketProc);
27422745

27432746
} else {

src/test/MsQuicTests.h

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
1010
--*/
1111

12+
#pragma once
13+
1214
//
1315
// For official releases, disable tests for preview features:
1416
// the official release test binary for a version is used for down-level compatibility testing
@@ -43,6 +45,14 @@ extern "C" {
4345
void QuicTestInitialize();
4446
void QuicTestUninitialize();
4547

48+
//
49+
// Parameter structures used by many tests
50+
//
51+
52+
struct FamilyArgs {
53+
int Family;
54+
};
55+
4656
//
4757
// Parameter Validation Tests
4858
//
@@ -52,7 +62,7 @@ void QuicTestValidateRegistration();
5262
void QuicTestValidateConfiguration();
5363
void QuicTestValidateListener();
5464
void QuicTestValidateConnection();
55-
void QuicTestValidateStream(bool Connect);
65+
void QuicTestValidateStream(const bool& Connect);
5666
void QuicTestCloseConnBeforeStreamFlush();
5767
void QuicTestGlobalParam();
5868
void QuicTestCommonParam();
@@ -61,7 +71,7 @@ void QuicTestConfigurationParam();
6171
void QuicTestListenerParam();
6272
void QuicTestConnectionParam();
6373
void QuicTestTlsParam();
64-
void QuicTestTlsHandshakeInfo(_In_ bool EnableResumption);
74+
void QuicTestTlsHandshakeInfo(const bool& EnableResumption);
6575
void QuicTestStreamParam();
6676
void QuicTestGetPerfCounters();
6777
void QuicTestVersionSettings();
@@ -84,7 +94,7 @@ void QuicTestConnectionCloseBeforeStreamClose();
8494
//
8595
// Rejection Tests
8696
//
87-
void QuicTestConnectionRejection(bool RejectByClosing);
97+
void QuicTestConnectionRejection(const bool& RejectByClosing);
8898

8999
//
90100
// Event Validation Tests
@@ -104,15 +114,15 @@ void QuicTestRegistrationOpenClose();
104114
void QuicTestCreateListener();
105115
void QuicTestStartListener();
106116
void QuicTestStartListenerMultiAlpns();
107-
void QuicTestStartListenerImplicit(_In_ int Family);
117+
void QuicTestStartListenerImplicit(const FamilyArgs& Params);
108118
void QuicTestStartTwoListeners();
109119
void QuicTestStartTwoListenersSameALPN();
110-
void QuicTestStartListenerExplicit(_In_ int Family);
120+
void QuicTestStartListenerExplicit(const FamilyArgs& Params);
111121
void QuicTestCreateConnection();
112-
void QuicTestBindConnectionImplicit(_In_ int Family);
113-
void QuicTestBindConnectionExplicit(_In_ int Family);
122+
void QuicTestBindConnectionImplicit(const FamilyArgs& Params);
123+
void QuicTestBindConnectionExplicit(const FamilyArgs& Params);
114124
void QuicTestConnectionCloseFromCallback();
115-
void QuicTestAddrFunctions(_In_ int Family);
125+
void QuicTestAddrFunctions(const FamilyArgs& Params);
116126

117127
//
118128
// MTU tests
@@ -131,7 +141,7 @@ QuicTestMtuDiscovery(
131141
//
132142
void
133143
QuicTestLocalPathChanges(
134-
_In_ int Family
144+
const FamilyArgs& Params
135145
);
136146

137147
//
@@ -169,17 +179,17 @@ QuicTestConnect(
169179
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
170180
void
171181
QuicTestVersionNegotiation(
172-
_In_ int Family
182+
const FamilyArgs& Params
173183
);
174184

175185
void
176186
QuicTestVersionNegotiationRetry(
177-
_In_ int Family
187+
const FamilyArgs& Params
178188
);
179189

180190
void
181191
QuicTestCompatibleVersionNegotiationRetry(
182-
_In_ int Family
192+
const FamilyArgs& Params
183193
);
184194

185195
void
@@ -205,12 +215,12 @@ QuicTestCompatibleVersionNegotiationDefaultServer(
205215

206216
void
207217
QuicTestIncompatibleVersionNegotiation(
208-
_In_ int Family
218+
const FamilyArgs& Params
209219
);
210220

211221
void
212222
QuicTestFailedVersionNegotiation(
213-
_In_ int Family
223+
const FamilyArgs& Params
214224
);
215225

216226
void
@@ -258,22 +268,22 @@ QuicTestInvalidAlpnLengths(
258268

259269
void
260270
QuicTestLoadBalancedHandshake(
261-
_In_ int Family
271+
const FamilyArgs& Params
262272
);
263273

264274
void
265275
QuicTestClientSharedLocalPort(
266-
_In_ int Family
276+
const FamilyArgs& Params
267277
);
268278

269279
void
270280
QuicTestInterfaceBinding(
271-
_In_ int Family
281+
const FamilyArgs& Params
272282
);
273283

274284
void
275285
QuicTestRetryMemoryLimitConnect(
276-
_In_ int Family
286+
const FamilyArgs& Params
277287
);
278288

279289
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
@@ -311,7 +321,7 @@ QuicTestShutdownDuringHandshake(
311321

312322
void
313323
QuicTestConnectUnreachable(
314-
_In_ int Family
324+
const FamilyArgs& Params
315325
);
316326

317327
void
@@ -320,17 +330,17 @@ QuicTestConnectInvalidAddress(
320330

321331
void
322332
QuicTestConnectBadAlpn(
323-
_In_ int Family
333+
const FamilyArgs& Params
324334
);
325335

326336
void
327337
QuicTestConnectBadSni(
328-
_In_ int Family
338+
const FamilyArgs& Params
329339
);
330340

331341
void
332342
QuicTestConnectServerRejected(
333-
_In_ int Family
343+
const FamilyArgs& Params
334344
);
335345

336346
void
@@ -355,7 +365,7 @@ QuicTestConnectExpiredClientCertificate(
355365

356366
void
357367
QuicTestClientBlockedSourcePort(
358-
_In_ int Family
368+
const FamilyArgs& Params
359369
);
360370

361371
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
@@ -437,12 +447,12 @@ QuicTestNatAddrRebind(
437447

438448
void
439449
QuicTestPathValidationTimeout(
440-
_In_ int Family
450+
const FamilyArgs& Params
441451
);
442452

443453
void
444454
QuicTestChangeMaxStreamID(
445-
_In_ int Family
455+
const FamilyArgs& Params
446456
);
447457

448458
//
@@ -474,7 +484,7 @@ QuicTestConnectAndPing(
474484

475485
void
476486
QuicTestConnectAndIdle(
477-
_In_ bool EnableKeepAlive
487+
const bool& EnableKeepAlive
478488
);
479489

480490
void
@@ -489,7 +499,7 @@ QuicTestServerDisconnect(
489499

490500
void
491501
QuicTestClientDisconnect(
492-
bool StopListenerFirst
502+
const bool& StopListenerFirst
493503
);
494504

495505
void
@@ -499,12 +509,12 @@ QuicTestStatelessResetKey(
499509

500510
void
501511
QuicTestForceKeyUpdate(
502-
_In_ int Family
512+
const FamilyArgs& Params
503513
);
504514

505515
void
506516
QuicTestKeyUpdate(
507-
_In_ int Family
517+
const FamilyArgs& Params
508518
);
509519

510520
void
@@ -579,13 +589,9 @@ QuicTestReceiveResumeNoData(
579589
_In_ QUIC_RECEIVE_RESUME_SHUTDOWN_TYPE ShutdownType
580590
);
581591

582-
struct FamilyArgs2 {
583-
int Family;
584-
};
585-
586592
void
587593
QuicTestAckSendDelay(
588-
const FamilyArgs2& Params
594+
const FamilyArgs& Params
589595
);
590596

591597
typedef enum QUIC_ABORT_RECEIVE_TYPE {
@@ -662,13 +668,44 @@ QuicTestConnectionStreamStartSendPriority(
662668

663669
void
664670
QuicTestEcn(
665-
_In_ int Family
671+
const FamilyArgs& Params
672+
);
673+
674+
struct AppProvidedBuffersConfig {
675+
uint32_t StreamStartBuffersNum;
676+
uint32_t StreamStartBuffersSize;
677+
uint32_t AdditionalBuffersNum;
678+
uint32_t AdditionalBuffersSize;
679+
};
680+
681+
void
682+
QuicTestStreamAppProvidedBuffers_ClientSend(
683+
const AppProvidedBuffersConfig& BufferConfig
684+
);
685+
686+
void
687+
QuicTestStreamAppProvidedBuffers_ServerSend(
688+
const AppProvidedBuffersConfig& BufferConfig
689+
);
690+
691+
void
692+
QuicTestStreamAppProvidedBuffersOutOfSpace_ClientSend_AbortStream(
693+
const AppProvidedBuffersConfig& BufferConfig
694+
);
695+
696+
void
697+
QuicTestStreamAppProvidedBuffersOutOfSpace_ClientSend_ProvideMoreBuffer(
698+
const AppProvidedBuffersConfig& BufferConfig
666699
);
667700

668-
void QuicTestStreamAppProvidedBuffers(
701+
void
702+
QuicTestStreamAppProvidedBuffersOutOfSpace_ServerSend_AbortStream(
703+
const AppProvidedBuffersConfig& BufferConfig
669704
);
670705

671-
void QuicTestStreamAppProvidedBuffersOutOfSpace(
706+
void
707+
QuicTestStreamAppProvidedBuffersOutOfSpace_ServerSend_ProvideMoreBuffer(
708+
const AppProvidedBuffersConfig& BufferConfig
672709
);
673710

674711
//
@@ -713,12 +750,12 @@ QuicTestDatagramNegotiation(
713750

714751
void
715752
QuicTestDatagramSend(
716-
_In_ int Family
753+
const FamilyArgs& Params
717754
);
718755

719756
void
720757
QuicTestDatagramDrop(
721-
_In_ int Family
758+
const FamilyArgs& Params
722759
);
723760

724761
//

0 commit comments

Comments
 (0)