Skip to content

Use Bytes for DATA payloads - #178

Merged
boivie merged 1 commit into
mainfrom
feature-bytes-4
Nov 12, 2026
Merged

boivie merged 1 commit into
mainfrom
feature-bytes-4

Conversation

@boivie

@boivie boivie commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

This changes the payload of DATA and I-DATA chunks (Data::payload) from
Vec to bytes::Bytes, completing the transition to Bytes for message
payloads throughout the RX and TX paths.

NOTE: There will be a follow-up pull request to optimize this further, to avoid unnecessary atomic reference count increments, which happen a lot while parsing. This PR is more mechanical to use Bytes for DATA paylods.

@boivie
boivie added this pull request to stack #179 November 9, 2026 11:39
@boivie
boivie force-pushed the feature-bytes-4 branch 2 times, most recently from a2c1af5 to c408601 Compare November 9, 2026 13:50
@boivie
boivie force-pushed the feature-bytes-4 branch 2 times, most recently from 5582b59 to d36c130 Compare November 10, 2026 08:05

@DanilChapovalov DanilChapovalov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lots of small blocks.
I was wondering if 'from_bytes' could be preserved at least for tests, but concluded it can't.... [unless RawChunk would be changed to keep owned Bytes, but that defeat the purpose of the optimization].
So asking to split API changes from the optimization.

btw, this optimization adds some complexity - RawChunk has pub fields, but same time got invariants regarding offset & packet & view relation. I wonder if such extra complexity is worth the saved atomic increments.

Comment thread src/fuzzer/fuzz_outstanding_data.rs Resolved
Comment thread src/packet/cookie_ack_chunk.rs Resolved
Comment thread src/packet/idata_chunk.rs Resolved
Comment thread src/packet/sctp_packet.rs Resolved
Comment thread src/packet/sctp_packet.rs Resolved
@boivie

boivie commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

I will split this commit into API + optimization; Just give me some time

@boivie boivie changed the title Use zero-copy Bytes in packet module Use Bytes for DATA payloads Nov 10, 2026
Comment thread src/rx/reassembly_queue.rs Resolved
Base automatically changed from feature-bytes-3 to main November 11, 2026 09:44
@boivie
boivie dismissed DanilChapovalov’s stale review November 11, 2026 09:44

The merge-base changed after approval.

@boivie
boivie force-pushed the feature-bytes-4 branch 2 times, most recently from 019731e to 462dd1a Compare November 11, 2026 21:33
Comment thread src/packet/sctp_packet.rs Resolved
Comment thread src/rx/reassembly_queue.rs Resolved
This changes the payload of DATA and I-DATA chunks (Data::payload) from
Vec<u8> to bytes::Bytes, completing the transition to Bytes for message
payloads throughout the RX and TX paths.
@boivie
boivie merged commit 6dfda76 into main Nov 12, 2026
16 checks passed
@boivie
boivie deleted the feature-bytes-4 branch November 12, 2026 12:25
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