Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streams Hold References on Connections #3931

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ QuicConnUninitialize(
QuicCryptoUninitialize(&Connection->Crypto);
QuicTimerWheelRemoveConnection(&Connection->Worker->TimerWheel, Connection);
QuicOperationQueueClear(Connection->Worker, &Connection->OperQ);
QuicLossDetectionUninitialize(&Connection->LossDetection);
QuicSendUninitialize(&Connection->Send);
csujedihy marked this conversation as resolved.
Show resolved Hide resolved

if (Connection->CloseReasonPhrase != NULL) {
CXPLAT_FREE(Connection->CloseReasonPhrase, QUIC_POOL_CLOSE_REASON);
Expand Down Expand Up @@ -5318,7 +5320,7 @@ QuicConnRecvFrames(
case QUIC_FRAME_IMMEDIATE_ACK: // Always accept the frame, because we always enable support.
AckImmediately = TRUE;
break;

case QUIC_FRAME_TIMESTAMP: { // Always accept the frame, because we always enable support.
if (!Connection->State.TimestampRecvNegotiated) {
QuicTraceEvent(
Expand All @@ -5345,7 +5347,7 @@ QuicConnRecvFrames(
Packet->SendTimestamp = Frame.Timestamp;
break;
}

default:
//
// No default case necessary, as we have already validated the frame
Expand Down
1 change: 1 addition & 0 deletions src/core/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ typedef enum QUIC_CONNECTION_REF {
QUIC_CONN_REF_LOOKUP_RESULT, // For connections returned from lookups.
QUIC_CONN_REF_WORKER, // Worker is (queued for) processing.
QUIC_CONN_REF_ROUTE, // Route resolution is undergoing.
QUIC_CONN_REF_STREAM, // A stream depends on the connection.

QUIC_CONN_REF_COUNT

Expand Down
8 changes: 6 additions & 2 deletions src/core/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ QuicStreamInitialize(
Stream->MaxAllowedRecvOffset = Stream->RecvBuffer.VirtualBufferLength;
Stream->RecvWindowLastUpdate = CxPlatTimeUs64();

QuicConnAddRef(Connection, QUIC_CONN_REF_STREAM);

Stream->Flags.Initialized = TRUE;
*NewStream = Stream;
Stream = NULL;
Expand Down Expand Up @@ -209,6 +211,8 @@ QuicStreamFree(
Stream);
#pragma warning(pop)
}

QuicConnRelease(Connection, QUIC_CONN_REF_STREAM);
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand Down Expand Up @@ -929,8 +933,8 @@ QuicStreamParamGet(
if (!Stream->Flags.RemoteCloseResetReliable) {
Status = QUIC_STATUS_INVALID_STATE;
break;
}
}

*(uint64_t*)Buffer = Stream->RecvMaxLength;
Status = QUIC_STATUS_SUCCESS;
break;
Expand Down
Loading