Skip to content

Forward vectored writes#45

Merged
quininer merged 4 commits intorustls:mainfrom
M4SS-Code:forward-vectored-writes
Mar 17, 2024
Merged

Forward vectored writes#45
quininer merged 4 commits intorustls:mainfrom
M4SS-Code:forward-vectored-writes

Conversation

@paolobarbolini
Copy link
Copy Markdown
Contributor

@paolobarbolini paolobarbolini commented Mar 3, 2024

Allows making use of rustls/rustls#1640.

Supersedes #25

I've also run tests with #44 and it seems to work correctly.

Closes #25
Closes #26

@paolobarbolini
Copy link
Copy Markdown
Contributor Author

Tests seem to get stuck every once in a while. It also happens on main

@djc djc requested review from ctz and quininer March 4, 2024 08:17
Comment thread src/common/mod.rs
@djc djc mentioned this pull request Mar 5, 2024
@quininer
Copy link
Copy Markdown
Member

quininer commented Mar 6, 2024

[tests/early-data.rs:187:9] &line = Ok(
    "wshutting down SSL",
)
[tests/early-data.rs:187:9] &line = Ok(
    "CONNECTION CLOSED",
)
[tests/early-data.rs:187:9] &line = Ok(
    "Early data received:",
)
[tests/early-data.rs:187:9] &line = Ok(
    "orld!",
)
[tests/early-data.rs:187:9] &line = Ok(
    "End of early data",
)

It seems that due to write_vectored, the probability of words (world!) being split increases. we need a better way to check openssl output.

@quininer
Copy link
Copy Markdown
Member

quininer commented Mar 7, 2024

As a performance improvement that doesn't have to block 0.23 release, I'll try to rewrite this test over the weekend (using rustls instead of openssl).

Comment thread src/common/mod.rs Outdated
@paolobarbolini
Copy link
Copy Markdown
Contributor Author

This early data situation looks weird. Even if I remove the poll_write_vectored implementation it continues to happen. It's almost like openssl doesn't like early data that is split across multiple packets.

@paolobarbolini
Copy link
Copy Markdown
Contributor Author

As a performance improvement that doesn't have to block 0.23 release, I'll try to rewrite this test over the weekend (using rustls instead of openssl).

I've decided to try rewriting it myself. I opted for simplicity and left the TCP connection doing the bridging between the sync and async world.
I'll rebase it later in the day once I can get back to this.

@paolobarbolini paolobarbolini requested a review from quininer March 10, 2024 12:54
Copy link
Copy Markdown
Member

@quininer quininer left a comment

Choose a reason for hiding this comment

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

LGTM

@quininer
Copy link
Copy Markdown
Member

I have a branch based on tokio-rustls server, but I think it would be nice to use a sync implement. thank you.

Copy link
Copy Markdown
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/client.rs Outdated
Comment thread tests/early-data.rs
Comment thread tests/utils.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs
use std::io::Write;

// write early data
if let Some(mut early_data) = stream.session.early_data() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a little different than what I thought it would be, but it's also good.

I actually think it should be outside the function.

@quininer quininer merged commit 3a153ac into rustls:main Mar 17, 2024
@quininer
Copy link
Copy Markdown
Member

Thank you!

@cpu cpu mentioned this pull request Mar 21, 2024
takumi-earth pushed a commit to earthlings-dev/tokio-rustls that referenced this pull request Jan 27, 2026
* Migrate early-data test to rustls

* Replace `match` with `if let` on `TlsState::EarlyData`

* Extract client early data handling

* Forward vectored writes
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.

Override poll_write_vectored?

4 participants