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

Minor improvements #66

Merged
merged 5 commits into from
Sep 10, 2024
Merged

Minor improvements #66

merged 5 commits into from
Sep 10, 2024

Conversation

Gelbpunkt
Copy link
Owner

While reviewing the code yet again to explore benchmark behavior I stumbled across a few things we should polish.

I assume the compiler optimizes this anyways, but it's nicer to look at
this way anyways.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
We would have used the slower UTF-8 validation method if we received
more data than necessary for completing the partial codepoint.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
@@ -57,7 +60,7 @@ impl WebSocketProtocol {
macro_rules! ensure_buffer_has_space {
($buf:expr, $space:expr) => {
if $buf.len() < $space {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this not be $buf.capacity()?

Copy link
Owner Author

Choose a reason for hiding this comment

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

No, this is purely about the data that is currently available to ensure that we can index further in the payload.

@Gelbpunkt Gelbpunkt merged commit 07ba99c into main Sep 10, 2024
18 checks passed
@Gelbpunkt Gelbpunkt deleted the minor-stuff branch September 10, 2024 22:08
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