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

Adjust packet size constant #407

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
16 changes: 9 additions & 7 deletions src/server/replication_messages/mutate_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ impl MutateMessage {
}

fn can_pack(message_size: usize, add: usize) -> bool {
const MAX_PACKET_SIZE: usize = 1200; // TODO: make it configurable by the messaging backend.
// Max size allowed by quinn datagrams.
// TODO: make it configurable by the messaging backend.
const MAX_PACKET_SIZE: usize = 1162;
Comment on lines +227 to +229
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather not inflict quinn implementation details on the other backends. Maybe it's time to implement the make it configurable by the messaging backend.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, I just wanted to make a temporary solution to fix the issue with quinn in a patch release.

Ideally I want resources as components to provide a nicer interaction with backends.

Copy link
Collaborator

@UkoeHB UkoeHB Feb 6, 2025

Choose a reason for hiding this comment

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

It should be easy enough to implement: add the setting to RepliconServer, let backends override it/edit it. If a quinn user desperately needs a workaround then they can pin to this branch until a proper solution is implemented.

We can't publish regressions on purpose in patch releases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like in QUIC it's a variable value per-connection. So it needs to be on ReplicatedClients.

I though using a more conservative value is not that bad, but you are right. I will convert this branch into a draft and implement a proper solution later.


let dangling = message_size % MAX_PACKET_SIZE;
(dangling > 0) && ((dangling + add) <= MAX_PACKET_SIZE)
Expand All @@ -237,13 +239,13 @@ mod tests {
#[test]
fn packing() {
assert!(can_pack(10, 5));
assert!(can_pack(10, 1190));
assert!(!can_pack(10, 1191));
assert!(can_pack(10, 1152));
assert!(!can_pack(10, 1153));
assert!(!can_pack(10, 3000));

assert!(can_pack(1199, 1));
assert!(!can_pack(1200, 0));
assert!(!can_pack(1200, 1));
assert!(!can_pack(1200, 3000));
assert!(can_pack(1161, 1));
assert!(!can_pack(1162, 0));
assert!(!can_pack(1162, 1));
assert!(!can_pack(1162, 3000));
}
}