Skip to content

Conversation

Johan511
Copy link
Contributor

@Johan511 Johan511 commented Jul 11, 2025

Description

Draft PR, requesting comments

Core changes made to send.c, stream_send.c.
Added file deadline_engine.c

Implements Deadline Awareness to streams as described in #5200 with some changes.
Thank you @nibanks for some ideas.

This PR aims to introduce a function StreamOpenWithDeadline()

_IRQL_requires_max_(DISPATCH_LEVEL)
QUIC_STATUS
QUIC_API
MsQuicStreamOpenWithDeadline(
    _In_ _Pre_defensive_ HQUIC Handle,
    _In_ QUIC_STREAM_OPEN_FLAGS Flags,
    _In_ _Pre_defensive_ QUIC_STREAM_CALLBACK_HANDLER Handler,
    _In_opt_ void* Context,
    _Outptr_ _At_(*NewStream, __drv_allocatesMem(Mem)) _Pre_defensive_
        HQUIC *NewStream,
    _In_ QUIC_TIME_DIFF MsToDeadline
    );

The goal of this function is the allow users to open streams which aim to drain the data queued into it within the mentioned deadline. This is achieved by making a minor change to QuicStreamSendCanWriteDataFrames where we also check if all the queued data can be drained before the deadline which is a statistical guess made by the DrainBeforeDeadlineEngine.

The DrainBeforeDeadlineEngine is implemented in a new file deadline_engine.c and uses information from the Congestion control system to make the "guess".

Due to it's dependence on the CongestionControl we use some internal congestion control information which are not exposed using an API (see the enum in deadline_engine.c). Requesting comments and preferred alternative solution on this dirty practice.

Testing

Added a basic sanity test for Deadline of 0ms and very large but valid deadline.
Requesting the PR be marked as draft until accuracy of deadline engine is measured.

Documentation

No documentation changes as of now.

To Do:

  • Measure accuracy of deadline engine
  • Documentation Changes
  • C# updates

@Johan511 Johan511 requested a review from a team as a code owner July 11, 2025 17:58
QUIC_CONNECTION_SEND_RESUMPTION_FN ConnectionSendResumptionTicket;

QUIC_STREAM_OPEN_FN StreamOpen;
QUIC_STREAM_OPEN_WITH_DEADLINE_FN StreamOpenWithDeadline;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New functions must be appended at the end, otherwise they break back compat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will do it.
Just curious, are you referring to ABI compatibility?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Existing compiled applications must be able to drop in the new version of msquic.dll/libmsquic.so without breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants