Skip to content

Conversation

@mufenqwq
Copy link
Contributor

@mufenqwq mufenqwq commented Aug 3, 2025

Add QUIC Datagram Extension (RFC 9221) Support

Summary

This PR implements the QUIC Datagram Extension as specified in RFC 9221, enabling unreliable, unordered datagram transmission over QUIC connections.
This feature allows applications to send and receive datagrams without the overhead of stream-based reliable delivery.


Features

  • Complete RFC 9221 Compliance: Full implementation of the QUIC Datagram Extension specification
  • Configurable Support: Enable/disable datagram support with configurable maximum frame sizes
  • Buffer Management: Separate send and receive buffers with configurable sizes (default: 1 MB each)
  • Flow Control: Automatic buffer overflow protection with optional drop-on-full behavior
  • MTU Awareness: Smart payload size calculation considering frame overhead and current MTU
  • Peer Capability Negotiation: Automatic detection and negotiation of peer datagram support

Implementation Details

Core Components

Component Description
DatagramConfig Configuration structure for datagram support settings
DatagramState State management for datagram sending and receiving
Frame::Datagram Added variant to the frame system
Connection Integration Seamless integration with existing QUIC connection logic

Key APIs

API Purpose
Config::set_datagram_enabled() Enable datagram support with optional max frame size
Config::set_datagram_send_buffer_size() Configure send buffer size
Config::set_datagram_recv_buffer_size() Configure receive buffer size
Connection::datagram_send() Send a datagram with optional drop-on-full behavior
Connection::datagram_recv() Receive the next available datagram
Connection::datagram_max_size() Get maximum datagram payload size
Connection::datagram_send_buffer_space() Check available send buffer space
Connection::datagram_recv_buffer_space() Check available receive buffer space

Transport Parameter Integration

  • Automatically negotiates max_datagram_frame_size transport parameter
  • Respects peer’s datagram capabilities during connection establishment
  • Properly handles cases where peer doesn’t support datagrams

resolve #222

@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2025

Codecov Report

❌ Patch coverage is 69.77492% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.47%. Comparing base (b62863a) to head (f03d6cd).

Files with missing lines Patch % Lines
src/connection/datagram.rs 77.00% 46 Missing ⚠️
src/connection/connection.rs 34.69% 32 Missing ⚠️
src/lib.rs 9.09% 10 Missing ⚠️
src/frame.rs 84.61% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #492      +/-   ##
===========================================
- Coverage    94.72%   94.47%   -0.26%     
===========================================
  Files           50       51       +1     
  Lines        30282    30591     +309     
===========================================
+ Hits         28685    28901     +216     
- Misses        1597     1690      +93     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mufenqwq mufenqwq changed the title [WIP] feat: support datagram extension feat: support datagram extension Aug 3, 2025
@mufenqwq mufenqwq changed the title feat: support datagram extension [WIP] feat: support datagram extension Aug 3, 2025
@mufenqwq mufenqwq changed the title [WIP] feat: support datagram extension feat: support datagram extension Aug 3, 2025
@mufenqwq mufenqwq closed this Dec 2, 2025
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.

Support Datagram Extension

3 participants